public Results.GenericResult <ToDoDto> Post([FromBody] ToDoDto model) { var result = new Results.GenericResult <ToDoDto>(); var validatorResult = validator.Validate(model); if (validatorResult.IsValid) { try { result.Result = appService.Create(model); result.Success = true; } catch (Exception ex) { result.Errors = new string[] { ex.Message }; } } else { result.Errors = validatorResult.GetErrors(); } return(result); }
public ToDoDTO Post([FromBody] ToDoDTO model) { return(_appService.Create(model)); }