public ActionResult Create([Bind(Include = "ID,Name,Horsepower,MaxSpeed,Image,Price,ClassID")] Model model) { model.ID = model.GetHashCode(); if (ModelState.IsValid) { db.Models.Add(model); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClassID = new SelectList(db.Classes, "ID", "Name", model.ClassID); return(View(model)); }
public ActionResult Create([Bind(Include = "ID,OrderDate,Price,SelectedClientID,SelectedModelID,AccessoriesIDs")] CreateOrderVM newOrder) { //Create New Order- mapped from order view model(use only order date and selected ids; Order ID is going to be hash code from OrderVM; Price is going to be decided from model and accessories) if (ModelState.IsValid) { Order order = serviceOrder.MapOrderViewModel(db, newOrder); db.Orders.Add(order); db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.ClientID = new SelectList(db.Clients, "ID", "FirstName", order.ClientID); return(View()); }
public int InsertPartsDetail(PartsDetail partsDetail) { _context.PartsDetails.Add(partsDetail); _context.SaveChanges(); return(partsDetail.PartsId); }
public int InsertPolUnitPrice(POLUnitPrice polUnitPrice) { _contex.POLUnitPrices.Add(polUnitPrice); _contex.SaveChanges(); return(polUnitPrice.POLUnitPriceId); }
public void save() { _context.SaveChanges(); }