public ActionResult Edit(JobCardTaskMaster model) { model.OrganizationId = OrganizationId; model.CreatedDate = System.DateTime.Now; model.CreatedBy = UserID.ToString(); var repo = new TaskRepository(); bool isexists = repo.IsFieldExists(repo.ConnectionString(), "JobCardTaskMaster", "JobCardTaskName", model.JobCardTaskName, "JobCardTaskMasterId", model.JobCardTaskMasterId); if (!isexists) { var result = new TaskRepository().UpdateTask(model); if (result.JobCardTaskMasterId > 0) { TempData["Success"] = "Updated Successfully!"; TempData["JobCardTaskRefNo"] = result.JobCardTaskRefNo; return(RedirectToAction("Create")); } else { TempData["error"] = "Oops!!..Something Went Wrong!!"; TempData["JobCardTaskRefNo"] = null; return(View("Create", model)); } } else { TempData["error"] = "This Name Alredy Exists!!"; TempData["JobCardTaskRefNo"] = null; return(View("Create", model)); } }