Esempio n. 1
0
        public ActionResult Update(int region, int athlete)
        {
            RegionUpdate regionUpdater = new RegionUpdate(region);
            regionUpdater.Update();

            return RedirectToAction("Index", "Region", new { athlete = athlete, region = region });
        }
Esempio n. 2
0
        /// <summary>
        /// Issue an event to all listeners telling them a region has been updated.
        /// </summary>
        /// <param name="regionID">The region ID of the region that was updated.</param>
        /// <remarks>the regionPages object must NOT be locked.</remarks>
        private static void IssueUpdate(int regionID)
        {
            bool entered = Monitor.IsEntered(regionPages);

            if (entered)
            {
                Monitor.Exit(regionPages);
            }
            RegionUpdate?.Invoke(regionID);
            if (entered)
            {
                Monitor.Enter(regionPages);
            }
        }
Esempio n. 3
0
        public async Task <ActionResult> UpdateRegionInfoAsync(string regionCode, RegionUpdate regionToUpdate)
        {
            var regModel = await _service.SearchRegionByCode(regionCode);

            if (regModel == null)
            {
                return(NotFound());
            }
            _mapper.Map(regionToUpdate, regModel);

            _service.UpdateRegion(regModel);
            _service.SaveChanges();

            return(Ok(_service.SearchRegionByCode(regionCode)));
        }