public PublicExpenseUpdateDto GetForEdit(int id) { PublicExpenseUpdateDto publicExpenseDto = null; try { var publicExpense = _unitOfWork.GenericRepository <PublicExpense>().GetById(id); if (publicExpense != null) { publicExpenseDto = Mapper.Map <PublicExpense, PublicExpenseUpdateDto>(publicExpense); } } catch (Exception ex) { Tracing.SaveException(ex); } return(publicExpenseDto); }
public PublicExpenseDto Update(PublicExpenseUpdateDto dto) { PublicExpenseDto publicExpenseDto = null; try { var publicExpense = _unitOfWork.GenericRepository <PublicExpense>().GetById(dto.Id); Mapper.Map <PublicExpenseUpdateDto, PublicExpense>(dto, publicExpense); publicExpense.ModifiedBy = _appSession.GetUserName(); _unitOfWork.CreateTransaction(); _unitOfWork.GenericRepository <PublicExpense>().Update(publicExpense); _unitOfWork.Save(); _unitOfWork.Commit(); publicExpenseDto = Mapper.Map <PublicExpense, PublicExpenseDto>(publicExpense); } catch (Exception ex) { Tracing.SaveException(ex); } return(publicExpenseDto); }