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