Exemplo n.º 1
0
 public BitOfNews Init(BitOfNewsUI bitOfNewsUI) => new BitOfNews
 {
     Id       = Guid.NewGuid().ToString(),
     Date     = DateTime.Now.ToString("dd-MM-yyyy, hh:mm:ss"),
     Title    = bitOfNewsUI.Title,
     Body     = bitOfNewsUI.Body,
     ImageUrl = bitOfNewsUI.ImageUrl
 };
Exemplo n.º 2
0
        public IActionResult PostBitOfNews(BitOfNewsUI bitOfNewsUI)
        {
            if (bitOfNewsUI == null)
            {
                return(BadRequest());
            }

            BitOfNews bitOfNews = newsService.Init(bitOfNewsUI);

            newsService.Save(bitOfNews);

            return(CreatedAtAction("GetBitOfNews", new { id = bitOfNews.Id }, bitOfNews));
        }