Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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());
        }
Esempio n. 5
0
        public SeverityViewModel Add(SeverityViewModel entity)
        {
            var severity = _repo.Add(_mapper.Map <Severity>(entity));

            return(_mapper.Map <SeverityViewModel>(severity));
        }
Esempio n. 6
0
 public SeverityControl(SeverityViewModel viewModel)
 {
     InitializeComponent();
     DataContext = viewModel;
     _viewModel  = viewModel;
 }