public ActionResult index(tblJobMaster _model, 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(); 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.AddNewjob(_model, adminId); if (msg.Contains("Error")) { ViewData["error"] = msg; return(View("job", _model)); } else { TempData["error"] = msg; return(RedirectToAction("GetJobs")); } } return(View("job", _model)); }
public string createjob(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; if (_model.EndDate < _model.StartDate) { return("Error : Start Date Can't be grater then End date"); } else { return(_services.AddNewjob(_model, adminId)); } }