public async Task <IActionResult> Post([FromBody] BLPublisher publisher) { if (publisher == null || publisher.Name.Length == 0) { return(BadRequest("Wrong game model")); } await _publisherService.AddAsync(publisher); return(Created(this.RouteData.ToString(), publisher)); }
public async Task <IActionResult> Get(int id) { BLPublisher publisher = await _publisherService.GetAsync(id); if (publisher?.Name == null) { return(NotFound()); } else { return(Ok(AutoMapper.Mapper.Map <BLPublisher, PublisherViewModel>(publisher))); } }
public async Task <IActionResult> Put(int id, [FromBody] BLPublisher publisher) { if (id == 0) { return(NotFound()); } if (publisher == null || publisher.Name.Length == 0) { return(NoContent()); } if (publisher.Id == 0 && id != 0) { publisher.Id = id; } await _publisherService.UpdateAsync(publisher); return(Ok()); }