public ServiceProviderEmployeeMappingModel SaveEmployeeAccordingToServiceProvider(ServiceProviderEmployeeMappingModel model) { //unitOfWork.StartTransaction(); ServiceProviderEmployeeMappingRepository repo = new ServiceProviderEmployeeMappingRepository(unitOfWork); ServicePoviderEmployeeMapping serviceProviderEmployeeMapping = new ServicePoviderEmployeeMapping(); AutoMapper.Mapper.Map(model, serviceProviderEmployeeMapping); repo.Insert(serviceProviderEmployeeMapping); //unitOfWork.Commit(); AutoMapper.Mapper.Map(serviceProviderEmployeeMapping, model); return model; }
public void DeleteServiceProviderEmployeeMapping(string employeeId) { //unitOfWork.StartTransaction(); ServiceProviderEmployeeMappingRepository repo = new ServiceProviderEmployeeMappingRepository(unitOfWork); ServicePoviderEmployeeMapping serviceProviderEmployeeMapping = new ServicePoviderEmployeeMapping(); serviceProviderEmployeeMapping = repo.GetAll().Where(x => x.EmployeeId == employeeId).FirstOrDefault(); if (serviceProviderEmployeeMapping != null) { repo.Delete(x => x.Id == serviceProviderEmployeeMapping.Id); } //unitOfWork.Commit(); }
public List<EmployeeModel> GetServiceProviderByEmployeeId(List<EmployeeModel> model) { //unitOfWork.StartTransaction(); List<ServiceProviderEmployeeMappingModel> serviceProviderEmployeeMappingModel = new List<ServiceProviderEmployeeMappingModel>(); ServiceProviderEmployeeMappingRepository repo = new ServiceProviderEmployeeMappingRepository(unitOfWork); ServicePoviderEmployeeMapping serviceProviderEmployeeMapping = new ServicePoviderEmployeeMapping(); model.ForEach(x => { serviceProviderEmployeeMapping = repo.GetAllIncluding("ServiceProvider").Where(y => y.EmployeeId == x.EmployeeId).FirstOrDefault(); if(serviceProviderEmployeeMapping!=null) x.ServiceProvider = serviceProviderEmployeeMapping.ServiceProvider.CompanyName; }); //unitOfWork.Commit(); // AutoMapper.Mapper.Map(serviceProviderEmployeeMapping, serviceProviderEmployeeMappingModel); return model; }