public PanelFilterDTO(AdminPanelFilter panelFilter) { Id = panelFilter.Id; ConceptId = panelFilter.ConceptId; UiDisplayText = panelFilter.UiDisplayText; UiDisplayDescription = panelFilter.UiDisplayDescription; }
public async Task <ActionResult <AdminPanelFilter> > UpdateAsync(int id, [FromBody] AdminPanelFilter pf) { try { if (pf != null) { pf.Id = id; } var updated = await manager.UpdateAsync(pf); return(updated); } catch (ArgumentException ae) { log.LogError("Invalid update PanelFilter model. Model:{@Model} Error:{Error}", pf, ae.Message); return(BadRequest()); } catch (LeafRPCException le) { return(StatusCode(le.StatusCode)); } catch (Exception ex) { log.LogError("Failed to update PanelFilter. Model:{@Model} Error:{Error}", pf, ex.ToString()); return(StatusCode(StatusCodes.Status500InternalServerError)); } }
public async Task <AdminPanelFilter> CreateAsync(AdminPanelFilter pf) { using (var cn = new SqlConnection(opts.ConnectionString)) { await cn.OpenAsync(); var created = await cn.QueryFirstOrDefaultAsync <AdminPanelFilter>( Sql.Create, new { conceptId = pf.ConceptId, isInclusion = pf.IsInclusion, uiDisplayText = pf.UiDisplayText, uiDisplayDescription = pf.UiDisplayDescription, user = user.UUID }, commandType : CommandType.StoredProcedure, commandTimeout : opts.DefaultTimeout); return(created); } }