public async Task <bool> UpdateCityAsync(CityDVM entity) { bool result = false; if (entity != null) { City d = cityRepository.Get(entity.CityId); if (d != null) { d.Name = entity.Name; d.StateCode = entity.StateCode; try { await cityRepository.UpdateAsync(d); result = true; } catch (Exception ex) { throw ex; } } } return(result); }
public async Task <bool> AddCityAsync(CityDVM entity) { bool id = false; if (entity != null) { City c = mapper.Map <City>(entity); try { var obj = await cityRepository.InsertAsync(c); id = true; } catch (Exception ex) { throw ex; } } return(id); }
public async Task <CityDVM> GetCityByIDAsync(object Id) { try { CityDVM cdvm = null; if (Id != null) { City d = await cityRepository.GetAsync(Id); if (d != null) { cdvm = mapper.Map <CityDVM>(d); } } return(cdvm); } catch (Exception e) { throw e; } }