public CompanyCommissionUpdateDto GetForEdit(int id) { CompanyCommissionUpdateDto companyCommissionDto = null; try { var companyCommission = _unitOfWork.GenericRepository <CompanyCommission>().GetById(id); if (companyCommission != null) { companyCommissionDto = Mapper.Map <CompanyCommission, CompanyCommissionUpdateDto>(companyCommission); } } catch (Exception ex) { Tracing.SaveException(ex); } return(companyCommissionDto); }
public CompanyCommissionDto Update(CompanyCommissionUpdateDto dto) { CompanyCommissionDto companyCommissionDto = null; try { var companyCommission = _unitOfWork.GenericRepository <CompanyCommission>().GetById(dto.Id); Mapper.Map <CompanyCommissionUpdateDto, CompanyCommission>(dto, companyCommission); companyCommission.ModifiedBy = _appSession.GetUserName(); _unitOfWork.CreateTransaction(); _unitOfWork.GenericRepository <CompanyCommission>().Update(companyCommission); _unitOfWork.Save(); _unitOfWork.Commit(); companyCommissionDto = Mapper.Map <CompanyCommission, CompanyCommissionDto>(companyCommission); } catch (Exception ex) { Tracing.SaveException(ex); } return(companyCommissionDto); }