public BranchCommissionUpdateDto GetForEdit(int id) { BranchCommissionUpdateDto branchCommissionDto = null; try { var branchCommission = _unitOfWork.GenericRepository <BranchCommission>().GetById(id); if (branchCommission != null) { branchCommissionDto = Mapper.Map <BranchCommission, BranchCommissionUpdateDto>(branchCommission); } } catch (Exception ex) { Tracing.SaveException(ex); } return(branchCommissionDto); }
public BranchCommissionDto Update(BranchCommissionUpdateDto dto) { BranchCommissionDto branchCommissionDto = null; try { var branchCommission = _unitOfWork.GenericRepository <BranchCommission>().GetById(dto.Id); Mapper.Map <BranchCommissionUpdateDto, BranchCommission>(dto, branchCommission); branchCommission.ModifiedBy = _appSession.GetUserName(); _unitOfWork.CreateTransaction(); _unitOfWork.GenericRepository <BranchCommission>().Update(branchCommission); _unitOfWork.Save(); _unitOfWork.Commit(); branchCommissionDto = Mapper.Map <BranchCommission, BranchCommissionDto>(branchCommission); } catch (Exception ex) { Tracing.SaveException(ex); } return(branchCommissionDto); }