public IActionResult Put([FromBody] EstateTempDto estate) { try { var validationErrors = this.validator.Validate(estate); if (validationErrors.Any()) { return(this.BadRequest(validationErrors)); } return(this.dataService.Update(estate) ? this.Ok() : (IActionResult)this.NotFound()); } catch (Exception ex) { return(this.StatusCode(500, ex.Message)); } }
public IActionResult Post([FromBody] EstateTempDto estate) { try { var validationErrors = this.validator.Validate(estate); if (validationErrors.Any()) { return(this.BadRequest(validationErrors)); } var newId = this.dataService.Create(estate); return(this.Ok(newId)); } catch (Exception ex) { return(this.StatusCode(500, ex.Message)); } }