public ActionResult Create([Bind(Include = "Id,TicketId,Property,EditId,OldValue,NewValue,Changed,UserId")] TicketHistory ticketHistory) { if (ModelState.IsValid) { db.TicketHistorys.Add(ticketHistory); db.SaveChanges(); //return RedirectToAction("Index"); //go back to ticket details return(RedirectToAction("Details", "Tickets", new { id = ticketHistory.TicketId })); } ViewBag.TicketId = new SelectList(db.Tickets, "Id", "Title", ticketHistory.TicketId); ViewBag.UserId = new SelectList(db.Users, "Id", "FirstName", ticketHistory.UserId); return(View(ticketHistory)); }
// GET: TicketHistory/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TicketHistory ticketHistory = db.TicketHistorys.Find(id); if (ticketHistory == null) { return(HttpNotFound()); } ViewBag.TicketId = new SelectList(db.Tickets, "Id", "Title", ticketHistory.TicketId); ViewBag.UserId = new SelectList(db.Users, "Id", "FirstName", ticketHistory.UserId); return(View(ticketHistory)); }