public ActionResult AddTicket(TicketCreateView TCV) { if (ModelState.IsValid) { TicketManager TM = new TicketManager(); UserManager UM = new UserManager(); TCV.UserID = UM.GetUserID(TCV.LoginName); TM.AddTicket(TCV); return(RedirectToAction("Welcome", "Home")); } return(View()); }
public void AddTicket(TicketCreateView ticket) { using (mwdEntities db = new mwdEntities()) { helpdesk HD = new helpdesk(); HD.UserID = ticket.UserID; HD.StatusID = ticket.StatusID; HD.SeverityID = ticket.SeverityID; HD.DepartmentID = ticket.DepartmentID; HD.Comments = ticket.Comments; HD.RowCreatedSYSUserID = ticket.UserID > 0 ? ticket.UserID : 1; HD.RowModifiedSYSUserID = ticket.UserID > 0 ? ticket.UserID : 1; HD.RowCreatedDateTime = DateTime.Now; HD.RowModifiedDateTime = DateTime.Now; db.helpdesks.Add(HD); db.SaveChanges(); } }