public string updatejob(bool IsActive, int id, string EndDate, string StartDate, string poNumber, string name, int TypeId, int StatusId, int AssignTo, string description) { int adminId = Convert.ToInt16(Session["AdminId"]); jobServices _services = new jobServices(); contactServices _ser = new contactServices(); tblJobMaster _model = new tblJobMaster(); _model.AssignTo = AssignTo; _model.Detail = description; _model.PoNumber = poNumber; _model.StartDate = Convert.ToDateTime(StartDate); _model.EndDate = Convert.ToDateTime(EndDate); _model.Name = name; _model.StatusId = StatusId; _model.TypeId = TypeId; _model.IsActive = IsActive; _model.Id = id; if (_model.EndDate < _model.StartDate) { return("Error : Start Date Can't be grater then End date"); } else { return(_services.updatejobbyId(_model)); } }
public ActionResult editjob(tblJobMaster _model, int JobStatusId, string shour, string ehour, string smin, string emin, string sampm, string eampm) { int adminId = Convert.ToInt16(Session["AdminId"]); jobServices _services = new jobServices(); contactServices _ser = new contactServices(); ViewData["users"] = _ser.GetaAllContactsByAdminId(adminId); ViewData["type"] = _services.getAllJobtypes(adminId); ViewData["status"] = _services.getAllStatus(); ViewData["statusId"] = JobStatusId; var date1 = _model.StartDate.Value.Date.ToShortDateString() + " " + shour + ":" + smin + ":00 " + sampm; var date2 = _model.EndDate.Value.Date.ToShortDateString() + " " + ehour + ":" + emin + ":00 " + eampm; _model.EndDate = Convert.ToDateTime(date2); _model.StartDate = Convert.ToDateTime(date1); if (_model.EndDate < _model.StartDate) { ViewData["error"] = "Start Date Can't be grater then End date"; } else { var msg = _services.updatejobbyId(_model); if (msg.Contains("Error")) { ViewData["error"] = msg; return(View("editjob", _model)); } else { TempData["error"] = msg; if (JobStatusId == 0) { return(RedirectToAction("getjobs")); } else { return(RedirectToAction("getjobs", "job", new { statusId = JobStatusId })); } } } return(View("editjob", _model)); }