public IActionResult PutProfile(int id, [FromBody] SystemProfileViewModel value) { try { //var result = _systemProfileAppService.GetById(id); //if (result == null) // return NotFound(); if (ModelState.IsValid) { _systemProfileAppService.Update(value); return(NoContent()); } return(BadRequest(new { Errors = ModelState })); } catch (BusisnessException ex) { return(BadRequest(new { Erros = ex.Message })); } catch (Exception ex) { _logger.LogError(ex.Message, ex.StackTrace); return(BadRequest(new { Errors = $"Erro não catalogado. Entre em contato com Administrador. Erro - {ex.Message}" })); } }
public IActionResult PostProfile([FromBody] SystemProfileViewModel value) { try { if (ModelState.IsValid) { _systemProfileAppService.Save(value); return(NoContent()); } return(BadRequest(new { Errors = ModelState })); } catch (BusisnessException ex) { return(BadRequest(new { Erros = ex.Message })); } catch (Exception ex) { _logger.LogError(ex.Message, ex.StackTrace); return(BadRequest(new { Errors = $"Erro não catalogado. Entre em contato com Administrador. Erro - {ex.Message}" })); } }
public void Update(SystemProfileViewModel systemProfileViewModel) { _systemProfileRepository.Update(_mapper.Map <SystemProfileViewModel, SystemProfile>(systemProfileViewModel)); }
public void Save(SystemProfileViewModel systemProfileViewModel) { _systemProfileRepository.Add(_mapper.Map <SystemProfileViewModel, SystemProfile>(systemProfileViewModel)); }