public void SaveEditedPurchase(Purchase purchase)
 {
     dbcontex.Entry(purchase).State = EntityState.Modified;
     dbcontex.SaveChanges();
 }
 public void DeletePurchase(Purchase purchase)
 {
     dbcontex.Purchases.Remove(purchase);
     dbcontex.SaveChanges();
 }
 public void CreatePurchase(Purchase purchase)
 {
     dbcontex.Purchases.Add(purchase);
     dbcontex.SaveChanges();
 }
예제 #4
0
 public ActionResult EditPurchase(Purchase purchase)
 {
     purchase.Date = DateTime.Now;
     repository.SaveEditedPurchase(purchase);
     return RedirectToAction("PurchasesList");
 }
예제 #5
0
 public ActionResult CreatePurchase(Purchase purchase)
 {
     purchase.Date = DateTime.Now;
     repository.CreatePurchase(purchase);
     // перенаправляем на главную страницу
     return RedirectToAction("PurchasesList");
 }
예제 #6
0
        public ActionResult CreatePurchase()
        {
            // Формируем список для передачи в представление
            ViewBag.Goods = new SelectList(repository.PureGoods().ToList(), "Id", "Title");//категории для формирования DropListDown

            Purchase newitem = new Purchase();
            return PartialView("PartialCreatePurchase", newitem);
        }