Add and Delete

  JobController.cs
        [HttpPost, Route("job/create")]
        [ValidateAntiForgeryToken]
        public ActionResult Create(JobViewModel model, IEnumerable<HttpPostedFileBase> files)
        {
            if (ModelState.IsValid)
            {
                var client = this.GetLoggedInClient();
                /* 
                 * Get a timestamp as filename prefix, 
                 * before uploading file, change the filename, the new file name (URL) save in database.
                 * maybe change later
                 */
                string fileNamePrefix = this._uploadService.GetFilePrefix();
                string newPictureURL = UploadFile(files, fileNamePrefix);   //upload file and get path

                Job newJob = this._clientService.PostNewJob(client.ID, model.Title, model.Description, model.SuburbId, model.GenderId, model.ServiceId, model.ServicedAt, newPictureURL);

                return RedirectToAction("Details/" + newJob.ID.ToString());
            }

            return View(model);
        }

Last updated

Was this helpful?