public ActionResult Create(int?Id, int?isProjectBased) { if (Id == null || isProjectBased == null) { TempData["error"] = "That was an invalid/unknown request. Please try again."; return(RedirectToAction("Index", "Home")); } JobOrderCompletionRepository repo = new JobOrderCompletionRepository(); var jobcard = repo.GetJobCardCompletion(Id ?? 0, isProjectBased ?? 0); FillEmployee(); FillTaks(jobcard.WorkDescriptionId ?? 0); jobcard.JobCardDate = DateTime.Now; jobcard.JobCardCompletedDate = DateTime.Now; jobcard.WarrentyPeriod = DateTime.Now; jobcard.isProjectBased = isProjectBased; //ViewBag.type = 1; return(View(jobcard)); }
public ActionResult Save(JobCardCompletion model) { try { JobOrderCompletionRepository repo = new JobOrderCompletionRepository(); repo.UpdateJobCardCompletion(model, UserID.ToString()); if (model.isOnHold) { TempData["success"] = model.JobCardNo + " has been put on hold"; } else { TempData["success"] = "Saved Successfully (" + model.JobCardNo + ")"; } return(RedirectToAction("Index", new { isProjectBased = model.isProjectBased })); } catch (Exception) { TempData["error"] = "Some error occured. Please try again."; return(View("Create", model)); } }