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"); }
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()}")); } }