public async Task <ActionResult> Create([Bind(Include = "ComponentId,ComponentName")] Component component)
        {
            if (ModelState.IsValid)
            {
                context.Entry(component).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }
            return(View(component));
        }
        public async Task <ActionResult> Create([Bind(Include = "EmpolyeeId,FIO,City,Address,Phone,Position")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                context.Entry(employee).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }
            return(View(employee));
        }
        public async Task <ActionResult> Create([Bind(Include = "SupplierId,SupplierFirm,DateDelivery,CityDelivery,AddressDelivery,PhoneDelivery")] Supplier supplier)
        {
            if (ModelState.IsValid)
            {
                context.Entry(supplier).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }
            return(View(supplier));
        }
        public async Task <ActionResult> Create([Bind(Include = "ModelId,ComponentId,ModelName")] Model model)
        {
            if (ModelState.IsValid)
            {
                context.Entry(model).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }
            ViewBag.ComponentId = new SelectList(context.Components, "ComponentId", "ComponentName", model.ComponentId);
            return(View(model));
        }
示例#5
0
        public async Task <ActionResult> Create([Bind(Include = "AssemblyPCId,CharacteristicPC,DateAssemblyPC,Amount,AssemblyPrice,PCName ")] AssemblyPc assembly)
        {
            if (ModelState.IsValid)
            {
                context.Entry(assembly).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }

            return(View(assembly));
        }
        public async Task <ActionResult> Create([Bind(Include = "PCSaleId,PCName,PricePC,SellDate,GuaranteePeriod ,PCStatus")] PCSale pCSale)
        {
            if (ModelState.IsValid)
            {
                context.Entry(pCSale).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }

            return(View(pCSale));
        }
        public async Task <ActionResult> Create([Bind(Include = " ReadyPCId,SupplierId,PurchasePrice,PCName,CharacteristicPC,Amount")] ReadyPC readyPC)
        {
            if (ModelState.IsValid)
            {
                context.Entry(readyPC).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }

            ViewBag.SupplierId = new SelectList(context.Suppliers, "SupplierId", "SupplierFirm", readyPC.SupplierId);
            return(View(readyPC));
        }
示例#8
0
        public async Task <ActionResult> Create([Bind(Include = "WarehouseComponentId,PurchaseId,ArrivalDate ,Amount")] WarehouseComponent warehouse)
        {
            if (ModelState.IsValid)
            {
                context.Entry(warehouse).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }

            ViewBag.PurchaseId = new SelectList(context.WarehouseComponents, "PurchaseId", "PurchaseId", warehouse.PurchaseId);
            return(View(warehouse));
        }
        public async Task <ActionResult> Create([Bind(Include = "PurchaseComponentId,ComponentId,ModelId,SupplierId,Availabity,Specifications,Price,GuaranteePeriod,DateIssue")] PurchasePCComponent purchase)
        {
            if (ModelState.IsValid)
            {
                context.Entry(purchase).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }
            ViewBag.ComponentId = new SelectList(context.Components, "ComponentId", "ComponentName", purchase.ComponentId);
            ViewBag.SupplierId  = new SelectList(context.Suppliers, "SupplierId", "SupplierFirm", purchase.SupplierId);
            ViewBag.ModelId     = new SelectList(context.Models, "ModelId", "ModelName", purchase.ModelId);
            return(View(purchase));
        }
示例#10
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));
        }
示例#11
0
        public async Task <ActionResult> Create([Bind(Include = "SaleId,WarehouseComponentId ,UnitPrice,Amount,EmployeeId,SaleDate,SumPrice")] RetailInvoice retail)
        {
            if (ModelState.IsValid)
            {
                context.Entry(retail).State = EntityState.Added;
                await context.SaveChangesAsync();

                TempData["SuccessMessage"] = "Запись добавлена";
                return(RedirectToAction("Index"));
            }

            ViewBag.EmployeeId           = new SelectList(context.Employees, "EmployeeId", "FIO", retail.EmployeeId);
            ViewBag.WarehouseComponentId = new SelectList(context.WarehouseComponents, "WarehouseComponentId", "WarehouseComponentId", retail.WarehouseComponentId);
            return(View(retail));
        }
示例#12
0
 public ActionResult Edit(Computer comp)
 {
     db.Entry(comp).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#13
0
 public void Update(Computer c)
 {
     db.Entry(c).State = System.Data.Entity.EntityState.Modified;
 }