Ejemplo n.º 1
0
        public object Put(City updated)
        {
            object json;

            try
            {
                City putting = repository.Update(updated);

                json = new
                {
                    total   = 1,
                    data    = putting,
                    success = true
                };
            }
            catch (Exception ex)
            {
                LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message);
                json = new
                {
                    message = ex.Message,
                    success = false
                };
            };

            return(json);
        }
Ejemplo n.º 2
0
 public void UpdateCities(params Cities[] cities)
 {
     if (ValidationCities(cities) == false)
     {
         return;
     }
     _citiesRepository.Update(cities);
 }
        public Cities UpdateCity(Cities city)
        {
            var getCity = _citiesRepository.GetFirstWhere(x => x.City.ToLower() == city.City.ToLower().Trim());

            if (getCity == null)
            {
                throw new FlowException("Градот не е пронајден!");
            }

            ValidateCity(city);

            getCity.Cases      = city.Cases;
            getCity.TodayCases = city.TodayCases;
            getCity.Latitude   = city.Latitude;
            getCity.Longitude  = city.Longitude;

            _citiesRepository.Update(getCity);
            _citiesRepository.SaveEntities();

            return(getCity);
        }