public async Task <ActionResult> EducationOfWages(List <PremiumAndRateView> premiumAndRates) { if (premiumAndRates == null || premiumAndRates.Count() == 0) { return(RedirectToAction("Staff")); } if (premiumAndRates.Count() != 0) { foreach (var item in premiumAndRates) { PremiumAndRateBll premiumMap = Mapper.Map <PremiumAndRateView, PremiumAndRateBll>(item); await _premiumAndRateServices.Update(premiumMap); } return(RedirectToAction("Staff")); } var position = Mapper.Map <IEnumerable <PositionView> >(await _position.GetTableAll()); ViewBag.Position = new SelectList(position, "idPosition", "name"); ViewBag.PositionAll = position; return(View()); }
private CarWashWorkersBll СreateListCarWashWorkers(PremiumAndRateBll premiumAndRate) { CarWashWorkersBll carWash = new CarWashWorkersBll(); carWash.id = premiumAndRate.carWashWorkersId; carWash.Name = premiumAndRate.CarWashWorkers.Name; carWash.Surname = premiumAndRate.CarWashWorkers.Surname + " " + premiumAndRate.CarWashWorkers.Name; carWash.Patronymic = premiumAndRate.CarWashWorkers.Patronymic; carWash.MobilePhone = premiumAndRate.CarWashWorkers.MobilePhone; return(carWash); }
public async Task CreatePremiumAndRateServices(int position, int carWashWorkersId) { var positionResult = await _position.GetTableAll(); PremiumAndRateBll premiumAndRates = new PremiumAndRateBll(); foreach (var item in positionResult) { premiumAndRates.carWashWorkersId = carWashWorkersId; //premiumAndRates.percentageStatusForOrder = true; premiumAndRates.percentageRatePerOrder = PercentageRatePerOrder(item.positionsOfAdministrators.Value, item.idPosition); premiumAndRates.positionsStatus = PositionsStatus(position, item.idPosition); premiumAndRates.positionId = item.idPosition; await Insert(premiumAndRates); } }
private premiumAndRate TransformAnEntity(PremiumAndRateBll entity) => Mapper.Map <PremiumAndRateBll, premiumAndRate>(entity);
public async Task Update(PremiumAndRateBll elementToUpdate) { _unitOfWork.PremiumAndRateServicesUnitOFWork.Update(TransformAnEntity(elementToUpdate)); await _unitOfWork.Save(); }
public async Task Insert(PremiumAndRateBll element) { _unitOfWork.PremiumAndRateServicesUnitOFWork.Insert(TransformAnEntity(element)); await _unitOfWork.Save(); }