public async Task <IActionResult> Post([FromBody] PostAuthorRequestModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(await Authors.Create( model.FirstName, model.LastName))); }
public async Task <IActionResult> Post([FromBody] PostAuthorRequestModel model) { var result = await this.authors.CreateAsync(model.FirstName, model.LastName); if (result == 0) { return(this.BadRequest("Fault! Author with this name already exist in database.")); } return(this.Ok(result)); }
public async Task <IActionResult> Post([FromBody] PostAuthorRequestModel authorModel) { await this.authorService.CreateAsync(authorModel.FirstName, authorModel.LastName); return(this.Ok(authorModel)); }
public async Task <IActionResult> Post([FromBody] PostAuthorRequestModel model) => this.Ok(await this.authors .Create(model.FirstName, model.LastName));
public async Task <IActionResult> Create([FromBody] PostAuthorRequestModel model) => this.Ok(await _authorsService.CreateAsync(model.FirstName, model.LastName));
public async Task <IActionResult> Post([FromBody] PostAuthorRequestModel model) { var id = await this.authorService.Create(model.FirstName, model.LastName); return(Ok(id)); }