public ActionResult Create(CustomerTicket customerticket) { if (ModelState.IsValid) { customerticket.CreatedDate = DateTime.Now; db.CustomerTicket.Add(customerticket); db.SaveChanges(); return RedirectToAction("Edits", "Customer", new { id = customerticket.CustomerId }); } ViewBag.CustomerId = new SelectList(db.Customer, "Id", "FirstName", customerticket.CustomerId); return RedirectToAction("Edits", "Customer", new { id = customerticket.CustomerId }); }
public object PostTicket(TicketModel loginModel) { CustomerTicket customerticket = new CustomerTicket { CustomerId = Convert.ToInt32(loginModel.id), Content = loginModel.content, CreatedDate = DateTime.Now, Title = "Title" }; db.CustomerTicket.Add(customerticket); db.SaveChanges(); //if (LoginManager.Login(loginModel.username, loginModel.password, out errorMessage)) //{ // return new { Result = true, User = LoginManager.CurrentUser.Transform() }; //} //else //{ return new { model = customerticket }; // } }
public ActionResult Edit(CustomerTicket customerticket) { if (ModelState.IsValid) { customerticket.CreatedDate = DateTime.Now; db.Entry(customerticket).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return RedirectToAction("Edits", "Customer", new { id = customerticket.CustomerId }); } ViewBag.CustomerId = new SelectList(db.Customer, "Id", "FirstName", customerticket.CustomerId); return RedirectToAction("Edits", "Customer", new { id = customerticket.CustomerId }); }