Exemplo n.º 1
0
 public void AddScreen(Screen screen)
 {
     _logger.LogInformation($"AddScreen, Name = {screen.Name}");
     screen.Name += $"#{screen.Id}";
     _screenRepository.AddScreen(screen);
     _cache.RemoveValueFromCache(AllScreens);
     _logger.LogInformation("Remove all screens from cache");
 }
Exemplo n.º 2
0
        public ActionResult Post([FromBody] Screen screen)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.ValidationState));
            }

            try
            {
                db.AddScreen(screen);
                return(NoContent());
            }
            catch (AlreadyExistsException aex)
            {
                return(Conflict(aex.Message));
            }
            catch (Exception ex)
            {
                return(InternalServerError($"Unable to process request.  Details: { ex.ToString()}"));
            }
        }