public async Task <bool> UpdateState(StateDVM entity) { bool result = false; if (entity != null) { State c = await stateRepository.GetAsync(entity.Code); if (c != null) { c.Name = entity.Name; c.CountryCode = entity.CountryCode; try { await stateRepository.UpdateAsync(c); result = true; } catch (Exception ex) { throw ex; } } } return(result); }
public async Task <bool> UpdateStateAsync(StateDVM entity) { bool result = false; if (entity != null) { State d = StateRepository.Get(entity.Code); if (d != null) { d.CountryId = entity.CountryId; d.Name = entity.Name; d.RegionCode = entity.RegionCode; try { await StateRepository.UpdateAsync(d); result = true; } catch (Exception ex) { throw ex; } } } return(result); }
public async Task <StateDVM> GetStateByID(object Id) { StateDVM cdvm = new StateDVM(); if (Id != null) { State c = await stateRepository.GetAsync(Id); if (c != null) { cdvm = mapper.Map <StateDVM>(c); } } return(cdvm); }
public async Task <bool> AddState(StateDVM entity) { bool id = false; if (entity != null) { State c = mapper.Map <State>(entity); try { var obj = await stateRepository.InsertAsync(c); id = true; } catch (Exception ex) { throw ex; } } return(id); }
public async Task <string> AddStateAsync(StateDVM entity) { string code = ""; if (entity != null) { State c = mapper.Map <State>(entity); try { var obj = await StateRepository.InsertAsync(c); code = obj.Code; } catch (Exception ex) { throw ex; } } return(code); }
public async Task <StateDVM> GetStateByIDAsync(object Id) { try { StateDVM pdvm = null; if (Id != null) { State d = await StateRepository.GetAsync(Id); if (d != null) { pdvm = mapper.Map <StateDVM>(d); } } return(pdvm); } catch (Exception e) { throw e; } }