private QuoteItem GetQuoteItem(QuoteItemDTO itemDTO) { return(new QuoteItem() { Id = 0, Author = itemDTO.Author, PrimaryText = itemDTO.PrimaryText, SecondaryText = itemDTO.SecondaryText, IsVisible = false, IsApproved = false }); }
public async Task <IActionResult> Post([FromBody] QuoteItemDTO item) { try { var model = GetQuoteItem(item); model.PostTime = DateTime.UtcNow; model.IsVisible = false; await _repository.Add(model); return(NoContent()); } catch (Exception) { return(BadRequest(new { Message = "Some errors occured. Please, try agian later." })); } }