Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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;
            }
        }