public async Task <IActionResult> Edit(short id, [Bind("IdEmployees,FullName,Position,Salary,Address,PhoneNumber")] Employees employees) { if (id != employees.IdEmployees) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => employeesrepository.Update(employees)); } catch (DbUpdateConcurrencyException) { if (!EmployeesExists(employees.IdEmployees)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Position"] = new SelectList(postionrepository.GetList(), "IdPosition", "Position1", employees.Position); return(View(employees)); }
public async Task <IActionResult> Edit(int id, [Bind("IdUnitOfmeasure,Names")] UnitOfMeasure unitOfMeasure) { if (id != unitOfMeasure.IdUnitOfmeasure) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => unitsrepo.Update(unitOfMeasure)); } catch (DbUpdateConcurrencyException) { if (!UnitOfMeasureExists(unitOfMeasure.IdUnitOfmeasure)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(unitOfMeasure)); }
public async Task <IActionResult> Edit(short id, [Bind("IdIngredients,Manufacturing,RawMaterials,Quantity")] Ingredients ingredients) { if (id != ingredients.IdIngredients) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => ingredientsrepo.Update(ingredients)); } catch (DbUpdateConcurrencyException) { if (!IngredientsExists(ingredients.IdIngredients)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Manufacturing"] = new SelectList(finishedProductsrepo.GetList(), "IdFinishedProducts", "Names", ingredients.Manufacturing); ViewData["RawMaterials"] = new SelectList(rawMaterialrepi.GetList(), "IdRawMaterials", "Names", ingredients.RawMaterials); return(View(ingredients)); }
public async Task <IActionResult> Edit(int id, [Bind("IdPurchaseOfcheese,RawMaterials,Quantity,Summ,Date,Employees")] PurchaseOfCheese purchaseOfCheese) { if (id != purchaseOfCheese.IdPurchaseOfcheese) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => purchaserepo.Update(purchaseOfCheese)); } catch (DbUpdateConcurrencyException) { if (!PurchaseOfCheeseExists(purchaseOfCheese.IdPurchaseOfcheese)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Employees"] = new SelectList(employeesrepo.GetList(), "IdEmployees", "FullName", purchaseOfCheese.Employees); ViewData["RawMaterials"] = new SelectList(rawMaterialsrepo.GetList(), "IdRawMaterials", "Names", purchaseOfCheese.RawMaterials); return(View(purchaseOfCheese)); }
public async Task <IActionResult> Edit(int id, [Bind("IdLoanRepayment,CreaditId,MonthForPay,YearForPay,DateOfPay,MonthlyPayment,ExpiredDays,Fine,TotalPayment")] LoanRepayment loanRepayment) { if (id != loanRepayment.IdLoanRepayment) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => loanRepaymentRepo.Update(loanRepayment)); } catch (DbUpdateConcurrencyException) { if (!LoanRepaymentExists(loanRepayment.IdLoanRepayment)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CreaditId"] = new SelectList(creditsRepsitory.GetList(), "IdCredits", "Name", loanRepayment.CreaditId); ViewData["MonthForPay"] = new SelectList(monthRepository.getMonths(), "IdMonth", "MonthName", loanRepayment.MonthForPay); // ViewData["YearForPay"] = new SelectList(yearsRepository.getYears(), "IdYears", "YearsName", loanRepayment.YearForPay); return(View(loanRepayment)); }
public async Task <IActionResult> Edit(short id, [Bind("IdRawMaterials,Names,UnitOfMeasure,Summ,Quantity")] RawMaterials rawMaterials) { if (id != rawMaterials.IdRawMaterials) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => rawMaterialsrepo.Update(rawMaterials)); } catch (DbUpdateConcurrencyException) { if (!RawMaterialsExists(rawMaterials.IdRawMaterials)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UnitOfMeasure"] = new SelectList(unitsrepo.GetList(), "IdUnitOfmeasure", "Names", rawMaterials.UnitOfMeasure); return(View(rawMaterials)); }
public async Task <IActionResult> Edit(byte id, [Bind("IdPosition,Position1")] Position position) { if (id != position.IdPosition) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => positionrepo.Update(position)); } catch (DbUpdateConcurrencyException) { if (!PositionExists(position.IdPosition)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(position)); }
public async Task <IActionResult> Edit(int id, [Bind("IdProductSales,FinishedProduct,Quantity,Summ,Date,Employees")] ProductSales productSales) { if (id != productSales.IdProductSales) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => productSalesrepo.Update(productSales)); } catch (DbUpdateConcurrencyException) { if (!ProductSalesExists(productSales.IdProductSales)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Employees"] = new SelectList(employeesrepo.GetList(), "IdEmployees", "FullName", productSales.Employees); ViewData["FinishedProduct"] = new SelectList(finishedProductsrepo.GetList(), "IdFinishedProducts", "Names", productSales.FinishedProduct); return(View(productSales)); }
public async Task <IActionResult> Edit(short id, [Bind("IdManufacture,Production,Quantity,Date,Employees")] Manufacture manufacture) { if (id != manufacture.IdManufacture) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => manfacturerepo.Update(manufacture)); } catch (DbUpdateConcurrencyException) { if (!ManufactureExists(manufacture.IdManufacture)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Employees"] = new SelectList(employeerepo.GetList(), "IdEmployees", "FullName", manufacture.Employees); ViewData["Production"] = new SelectList(finishedProductsrepo.GetList(), "IdFinishedProducts", "Names", manufacture.Production); return(View(manufacture)); }
public async Task <IActionResult> Edit(short id, [Bind("IdCredits,Name,CreaditAmount,InterestRate,CreditTerm,DateOfIssue,MonthlyPayment,Fine")] Credits credits) { if (id != credits.IdCredits) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => creditsrepo.Update(credits)); } catch (DbUpdateConcurrencyException) { if (!CreditsExists(credits.IdCredits)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(credits)); }
public async Task <IActionResult> Edit(int id, [Bind("IdFinishedProducts,Names,UnitOfMeasure,Summ,Quantity")] FinishedProducts finishedProducts) { if (id != finishedProducts.IdFinishedProducts) { return(NotFound()); } if (ModelState.IsValid) { try { await Task.Run(() => finishedProductsrepo.Update(finishedProducts)); } catch (DbUpdateConcurrencyException) { if (!FinishedProductsExists(finishedProducts.IdFinishedProducts)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UnitOfMeasure"] = new SelectList(unitsrepo.GetList(), "IdUnitOfmeasure", "Names", finishedProducts.UnitOfMeasure); return(View(finishedProducts)); }
public static void PrintInfo(ICrudable crudable) { crudable.Add(); crudable.Update(); crudable.Delete(); crudable.Read(); Console.WriteLine(); }
public static void DoDbOperation(ICrudable icrudable) { Console.WriteLine("In side DoDbOperation"); icrudable.Create(); icrudable.Read(); icrudable.Delete(); icrudable.Update(); }
public static void DoDbOperation(ICrudable crud) { Console.WriteLine("Doing db operations"); crud.Create(); crud.Read(); crud.Update(); crud.Delete(); }
public static void DoDbOpperation(ICrudable crudOp) { Console.WriteLine("Inside Db operation"); crudOp.Create(); crudOp.Read(); crudOp.Update(); crudOp.Delete(); }