public bool Update(SeverityViewModel entity) { var severity = _repo.Find(x => x.Id == entity.Id && x.Deleted == false); if (severity != null) { return(_repo.Update(_mapper.Map <Severity>(entity))); } return(false); }
public override bool TryCreateColumnContent(ITableEntryHandle entry, bool singleColumnView, out FrameworkElement?content) { if (!entry.TryGetValue(Severity, out AnalyzerSetting severity)) { content = null; return(false); } var viewModel = new SeverityViewModel(severity); var control = new SeverityControl(viewModel); content = control; return(true); }
public IActionResult Post([FromBody] SeverityViewModel severityViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var severity = _service.Add(severityViewModel); if (severity is null) { return(NoContent()); } return(CreatedAtAction(nameof(Get), new { severity.Id }, severity)); }
public IActionResult Put(int id, [FromBody] SeverityViewModel severityViewModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } severityViewModel.Id = id; bool resultUpdate = _service.Update(severityViewModel); if (!resultUpdate) { return(NoContent()); } return(Ok()); }
public SeverityViewModel Add(SeverityViewModel entity) { var severity = _repo.Add(_mapper.Map <Severity>(entity)); return(_mapper.Map <SeverityViewModel>(severity)); }
public SeverityControl(SeverityViewModel viewModel) { InitializeComponent(); DataContext = viewModel; _viewModel = viewModel; }