Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
        // 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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        // 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));
        }