public async Task <IActionResult> Create([Bind("IdLoanRepayment,CreaditId,MonthForPay,YearForPay,DateOfPay,MonthlyPayment,ExpiredDays,Fine,TotalPayment")] LoanRepayment loanRepayment) { if (ModelState.IsValid) { if (loanRepayment.GetPermission() == 1) { await Task.Run(() => loanRepaymentRepo.Create(loanRepayment)); return(RedirectToAction(nameof(Index))); } else if (loanRepayment.GetPermission() == 0) { return(NotFound("Credit fully paid")); } else if (loanRepayment.GetPermission() == 2) { return(NotFound("Amount of budget is not enough")); } else if (loanRepayment.GetPermission() == 3) { return(NotFound("Incorrect date for pay")); } } 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 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(); }
public async Task <IActionResult> Create([Bind("IdUnitOfmeasure,Names")] UnitOfMeasure unitOfMeasure) { if (ModelState.IsValid) { await Task.Run(() => unitsrepo.Create(unitOfMeasure)); return(RedirectToAction(nameof(Index))); } return(View(unitOfMeasure)); }
public async Task <IActionResult> Create([Bind("IdPosition,Position1")] Position position) { if (ModelState.IsValid) { await Task.Run(() => positionrepo.Create(position)); return(RedirectToAction(nameof(Index))); } return(View(position)); }
public async Task <IActionResult> Create([Bind("IdCredits,Name,CreaditAmount,InterestRate,CreditTerm,DateOfIssue,MonthlyPayment,Fine")] Credits credits) { if (ModelState.IsValid) { await Task.Run(() => creditsrepo.Create(credits)); return(RedirectToAction(nameof(Index))); } return(View(credits)); }
public async Task <IActionResult> Create([Bind("IdEmployees,FullName,Position,Salary,Address,PhoneNumber")] Employees employees) { if (ModelState.IsValid) { await Task.Run(() => employeesrepository.Create(employees)); return(RedirectToAction(nameof(Index))); } ViewData["Position"] = new SelectList(postionrepository.GetList(), "IdPosition", "Position1", employees.Position); return(View(employees)); }
public async Task <IActionResult> Create([Bind("IdRawMaterials,Names,UnitOfMeasure,Summ,Quantity")] RawMaterials rawMaterials) { if (ModelState.IsValid) { await Task.Run(() => rawMaterialsrepo.Create(rawMaterials)); return(RedirectToAction(nameof(Index))); } ViewData["UnitOfMeasure"] = new SelectList(unitsrepo.GetList(), "IdUnitOfmeasure", "Names", rawMaterials.UnitOfMeasure); return(View(rawMaterials)); }
public async Task <IActionResult> Create([Bind("IdFinishedProducts,Names,UnitOfMeasure,Summ,Quantity")] FinishedProducts finishedProducts) { if (ModelState.IsValid) { await Task.Run(() => finishedProductsrepo.Create(finishedProducts)); return(RedirectToAction(nameof(Index))); } ViewData["UnitOfMeasure"] = new SelectList(unitsrepo.GetList(), "IdUnitOfmeasure", "Names", finishedProducts.UnitOfMeasure); return(View(finishedProducts)); }
public async Task <IActionResult> Create([Bind("IdIngredients,Manufacturing,RawMaterials,Quantity")] Ingredients ingredients) { if (ModelState.IsValid) { await Task.Run(() => ingredientsrepo.Create(ingredients)); 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> Create([Bind("IdPurchaseOfcheese,RawMaterials,Quantity,Summ,Date,Employees")] PurchaseOfCheese purchaseOfCheese) { if (ModelState.IsValid) { try { await Task.Run(() => purchaserepo.Create(purchaseOfCheese)); return(RedirectToAction(nameof(Index))); } catch { ViewBag.message = "Недостаточно суммы в бюджете для покупки сырья"; ViewData["Employees"] = new SelectList(employeesrepo.GetList(), "IdEmployees", "FullName", purchaseOfCheese.Employees); ViewData["RawMaterials"] = new SelectList(rawMaterialsrepo.GetList(), "IdRawMaterials", "Names", purchaseOfCheese.RawMaterials); return(View(purchaseOfCheese)); } } return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Create([Bind("IdProductSales,FinishedProduct,Quantity,Summ,Date,Employees")] ProductSales productSales) { if (ModelState.IsValid) { try { await Task.Run(() => productSalesrepo.Create(productSales)); return(RedirectToAction(nameof(Index))); } catch { ViewBag.message = "Недостаточно колличество продукции для продажи"; ViewData["Employees"] = new SelectList(employeesrepo.GetList(), "IdEmployees", "FullName", productSales.Employees); ViewData["FinishedProduct"] = new SelectList(finishedProductsrepo.GetList(), "IdFinishedProducts", "Names", productSales.FinishedProduct); return(View(productSales)); } } return(RedirectToAction(nameof(Index))); }
public async Task <IActionResult> Create([Bind("IdManufacture,Production,Quantity,Date,Employees")] Manufacture manufacture) { if (ModelState.IsValid) { try { await Task.Run(() => manfacturerepo.Create(manufacture)); return(RedirectToAction(nameof(Index))); } catch { ViewBag.message = "Не достаточно Сырья Для производство продукции"; ViewData["Employees"] = new SelectList(employeerepo.GetList(), "IdEmployees", "FullName", manufacture.Employees); ViewData["Production"] = new SelectList(finishedProductsrepo.GetList(), "IdFinishedProducts", "Names", manufacture.Production); return(View(manufacture)); } } return(RedirectToAction(nameof(Index))); }