예제 #1
0
 public async Task <Boolean> UpdateZoneAsync(string zoneId, Pages.API.Model.Zone zone)
 {
     if (!(await PreConditionPageMustExist(zone.PageId)))
     {
         return(false);
     }
     return(await _zoneRepository.UpdateZoneAsync(zoneId, zone));
 }
예제 #2
0
        public async Task <ActionResult <Zone> > Put(int id, [FromBody] Zone zone)
        {
            try
            {
                if (await repository.FindZoneAsync(id) == null)
                {
                    return(NotFound());
                }
                zone.Id = id;
                zone    = await repository.UpdateZoneAsync(zone);

                return(Ok(zone));
            }
            catch (Exception ex)
            {
                logger.LogError(ex.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message));
            }
        }