public ActionResult JobsAdd() { var model = new JobCreateClientViewModel { Description = "" }; return View(model); }
public async Task<ActionResult> JobsAdd(JobCreateClientViewModel model) { if (ModelState.IsValid) { Job job = new Job(); job.OpenDate = DateTime.Now; job.Status = 0; job.Description = model.Description; job.ClientId = User.Identity.GetUserId(); db.Jobs.Add(job); await db.SaveChangesAsync(); return RedirectToAction("Jobs", "Client"); } // If we got this far, something failed, redisplay form return View(model); }