// GET: SalesController/Create public ActionResult Create() { CreateSale createSale = new CreateSale(); createSale.CarList = _carService.All().CarList; return(View(createSale)); }
public Sale Add(CreateSale createSale) { Sale sale = new Sale(); sale.BuyerName = createSale.BuyerName; sale.SellerName = createSale.SellerName; sale.TimeOfSale = DateTime.Now; sale.CarInQuestion = _carRepo.Read(createSale.CarInQuestionId); return(_saleRepo.Create(sale)); }
public ActionResult Create(CreateSale createSale) { if (ModelState.IsValid) { _saleService.Add(createSale); return(RedirectToAction(nameof(Index))); } else { return(View(createSale)); } }
public Sale Edit(int id, CreateSale sale) { Sale saleToUpdate = FindById(id); if (saleToUpdate == null) { return(null); } saleToUpdate.BuyerName = sale.BuyerName; saleToUpdate.SellerName = sale.SellerName; saleToUpdate.CarInQuestionId = sale.CarInQuestionId; return(_saleRepo.Update(saleToUpdate)); }
// POST: api/Sale public void Post([FromBody] CreateSale create) { manager.Add(create); }