public async Task <ActionResult <AppNavItemModel> > Create( [FromBody] AppNavItemModel model ) { try { await repository.SaveAsync(model, User.Identity.Name); return(model); } catch (Exception ex) { logger.LogError(ex, $"Can not save {model.ToJson()} to app_nav_items."); return(this.InternalServerError(ex)); } }
public async Task <ActionResult <AppNavItemModel> > Update( [FromRoute] long id, [FromBody] AppNavItemModel model ) { try { var exists = await repository.ExistAsync(id); if (!exists) { return(NotFound()); } model.Id = id.ToString(); await repository.UpdateAsync(id, model, User.Identity.Name); return(model); } catch (Exception ex) { logger.LogError(ex, $"Can not update app_nav_items by {id} with {model.ToJson()} ."); return(this.InternalServerError(ex)); } }