public ActionResult Create(Issue issue) { context.Issues.Add(issue); context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Issue issue) { if (ModelState.IsValid) { context.Add(issue); context.SaveChanges(); return(RedirectToAction("Index")); } return(View(issue)); }
public ActionResult EditTicket(IssueInfo info) { using (IssueDbContext db = new IssueDbContext()) { var result = db.RegisterTickets.SingleOrDefault(u => u.UserId == info.UserId); if (result != null) { result.AssignTo = info.AssignTo; result.Status = info.Status; if (info.Status.ToUpper() == "CLOSED") { result.ClosedDate = DateTime.Now.ToString(); result.ClosedBy = info.ClosedBy; } else { result.ClosedDate = "Pending"; result.ClosedBy = "Pending"; } db.SaveChanges(); } } return(RedirectToAction("ViewIssue")); }
public ActionResult CreateTicket(IssueInfo issueInfo, HttpPostedFileBase img) { issueInfo.TicketId = Guid.NewGuid().ToString().Substring(0, 8); var UserData = Session["users"] as UsersInfo; issueInfo.Email = UserData.Email; issueInfo.image = img != null ? img.FileName : ""; if (img != null) { using (IssueDbContext db = new IssueDbContext()) { string path = Path.Combine(Server.MapPath("~/Content/photos"), Path.GetFileName(img.FileName)); img.SaveAs(path); var result = db.RegisterTickets.Add(issueInfo); if (result != null) { db.SaveChanges(); } return(View()); } ViewBag.Message = "TicketId:" + " " + issueInfo.TicketId; } return(View()); }
public ActionResult EditTicket(IssueInfo info) { using (IssueDbContext db = new IssueDbContext()) { var result = db.RegisterTickets.SingleOrDefault(u => u.UserId == info.UserId); if (result != null) { result.Status = info.Status; db.SaveChanges(); } } return(RedirectToAction("ViewIssue")); }
public void Delete(Issue issue) { db.Issues.Remove(issue); db.SaveChanges(); }