public CompanyCashFlowUpdateDto GetForEdit(int id) { CompanyCashFlowUpdateDto companyCashFlowDto = null; try { var companyCashFlow = _unitOfWork.GenericRepository <CompanyCashFlow>().GetById(id); if (companyCashFlow != null) { companyCashFlowDto = Mapper.Map <CompanyCashFlow, CompanyCashFlowUpdateDto>(companyCashFlow); } } catch (Exception ex) { Tracing.SaveException(ex); } return(companyCashFlowDto); }
public CompanyCashFlowDto Update(CompanyCashFlowUpdateDto dto) { CompanyCashFlowDto companyCashFlowDto = null; try { var companyCashFlow = _unitOfWork.GenericRepository <CompanyCashFlow>().GetById(dto.Id); Mapper.Map <CompanyCashFlowUpdateDto, CompanyCashFlow>(dto, companyCashFlow); companyCashFlow.ModifiedBy = _appSession.GetUserName(); _unitOfWork.CreateTransaction(); _unitOfWork.GenericRepository <CompanyCashFlow>().Update(companyCashFlow); _unitOfWork.Save(); _unitOfWork.Commit(); companyCashFlowDto = Mapper.Map <CompanyCashFlow, CompanyCashFlowDto>(companyCashFlow); } catch (Exception ex) { Tracing.SaveException(ex); } return(companyCashFlowDto); }