public async Task <ActionResult> DeleteConfirmed(int id) { ProfitBill profit = await context.ProfitBills.FindAsync(id); context.ProfitBills.Remove(profit); await context.SaveChangesAsync(); TempData["SuccessMessage"] = "Запись удалена"; return(RedirectToAction("Index")); }
// GET: ProfitBills/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProfitBill profit = await context.ProfitBills.FindAsync(id); if (profit == null) { return(HttpNotFound()); } return(View(profit)); }
public async Task <ActionResult> Create([Bind(Include = "PurchaseId,PurchaseComponentId ,SupplierId,UnitPrice,Amount,PurchaseDate,SumPrice")] ProfitBill profit) { if (ModelState.IsValid) { context.Entry(profit).State = EntityState.Added; await context.SaveChangesAsync(); TempData["SuccessMessage"] = "Запись добавлена"; return(RedirectToAction("Index")); } ViewBag.PurchaseComponentId = new SelectList(context.PurchasePCComponents, "PurchaseComponentId ", "Model.ModelName", profit.PurchaseComponentId); ViewBag.SupplierId = new SelectList(context.Suppliers, "SupplierId", "SupplierFirm", profit.SupplierId); return(View(profit)); }
// GET: ProfitBills/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProfitBill profit = await context.ProfitBills.FindAsync(id); if (profit == null) { return(HttpNotFound()); } ViewBag.SupplierId = new SelectList(context.Suppliers, "SupplierId", "SupplierFirm"); ViewBag.PurchaseComponentId = new SelectList(context.PurchasePCComponents, "PurchaseComponentId ", "Model.ModelName"); return(View(profit)); }