예제 #1
0
        public ActionResult JobsAdd()
        {
            var model = new JobCreateClientViewModel
            {
                Description = ""
            };

            return View(model);
        }
예제 #2
0
        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);
        }