public async Task Update(CostsCarWashAndDeteylingBll elementToUpdate) { costsCarWashAndDeteyling costsCarWashAndDeteylings = Mapper.Map <CostsCarWashAndDeteylingBll, costsCarWashAndDeteyling>(elementToUpdate); _unitOfWork.costsCarWashAndDeteylingUnitOfWork.Update(costsCarWashAndDeteylings); await _unitOfWork.Save(); }
public async Task Insert(CostsCarWashAndDeteylingBll element) { costsCarWashAndDeteyling costsCarWashAndDeteylings = Mapper.Map <CostsCarWashAndDeteylingBll, costsCarWashAndDeteyling>(element); _unitOfWork.costsCarWashAndDeteylingUnitOfWork.Insert(costsCarWashAndDeteylings); await _unitOfWork.Save(); }
public async Task <ActionResult> Edit([Bind(Include = "idCostsCarWashAndDeteyling,nameExpenses,amount,dateExpenses,expenseCategoryId,typeServicesId")] CostsCarWashAndDeteylingView costsCarWashAndDeteylingView) { if (ModelState.IsValid) { CostsCarWashAndDeteylingBll costsCarWashAndDeteyling = Mapper.Map <CostsCarWashAndDeteylingView, CostsCarWashAndDeteylingBll>(costsCarWashAndDeteylingView); await _costsCarWashAndDeteyling.Update(costsCarWashAndDeteyling); return(RedirectToAction("Index")); } ViewBag.Category = new SelectList(await _expenseCategory.GetTableAll(), "idExpenseCategory", "name"); return(View(costsCarWashAndDeteylingView)); }
public async Task SaveExpenses(AllExpensesBll allExpenses) { if (allExpenses.expenseCategoryId == 2 || allExpenses.expenseCategoryId == 3) { CostsCarWashAndDeteylingBll costsCarWash = new CostsCarWashAndDeteylingBll(); costsCarWash.nameExpenses = allExpenses.nameExpenses; costsCarWash.expenseCategoryId = allExpenses.expenseCategoryId; costsCarWash.dateExpenses = allExpenses.dateExpenses; costsCarWash.amount = allExpenses.amount; costsCarWash.typeServicesId = allExpenses.typeServicesId; await _costsCarWashAndDeteyling.Insert(costsCarWash); } else if (allExpenses.expenseCategoryId == 5) { UtilityCostsBll utilityCosts = new UtilityCostsBll(); utilityCosts.indicationCounter = allExpenses.indicationCounter; utilityCosts.amount = allExpenses.amount; utilityCosts.dateExpenses = allExpenses.dateExpenses; utilityCosts.expenseCategoryId = allExpenses.expenseCategoryId; utilityCosts.utilityCostsCategoryId = allExpenses.utilityCostsCategoryId; await _utilityCosts.Insert(utilityCosts); } else if (allExpenses.expenseCategoryId == 6) { OtherExpensesBll otherExpenses = new OtherExpensesBll(); otherExpenses.nameExpenses = allExpenses.nameExpenses; otherExpenses.amount = allExpenses.amount; otherExpenses.dateExpenses = allExpenses.dateExpenses; otherExpenses.expenseCategoryId = allExpenses.expenseCategoryId; await _otherExpenses.Insert(otherExpenses); } }