public virtual ActionResult Edit([Bind(Include = "Id,Name,Email,Address")] CustomerViewModel customer) { if (ModelState.IsValid) { _db.Entry(customer.ToCustomer()).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public virtual ActionResult Edit([Bind(Include = "Id,Name,Color,Price,DateAdded,CustomerId")] ProductViewModel product) { if (ModelState.IsValid) { _db.Entry(product.ToProduct()).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(_db.Customers, "Id", "Name", product.CustomerId); return(View(product)); }
public virtual ActionResult Edit(TicketViewModel ticket) { if (ModelState.IsValid) { ticket.OwnerId = User.Identity.GetUserId(); _db.Entry(ticket.ToTicket()).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductId = new SelectList(_db.Products, "Id", "Name"); return(View(ticket)); }