public data.Entities.Account MapToEntity(int regionalAccountCodeId) { var account = new data.Entities.Account() { RegionalAccountCodeId = regionalAccountCodeId, SubNo = this.SubNo, ShredNo = this.ShredNo, Description = this.Description, AnnualBudget = this.AnnualBudget }; return(account); }
public ViewModels.Account Create(ViewModels.Account accountModel) { data.Entities.Account acc = null; try { acc = _repository.Create(_mapper.Map <data.Entities.Account>(accountModel)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } return(_mapper.Map <ViewModels.Account>(acc)); }
public ViewModels.Account Update(ViewModels.Account accountModel) { data.Entities.Account changedAccount = null; try { changedAccount = _repository.Update(_mapper.Map <data.Entities.Account>(accountModel)); } catch (Exception ex) { Console.WriteLine(ex.Message); return(null); } accountModel = _mapper.Map <ViewModels.Account>(changedAccount); return(accountModel); }