Esempio n. 1
0
        public override IHttpActionResult Post(NewsViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            viewModel.Date = DateTime.Now;
            News model = newsManager.Add(ToModel(viewModel));

            NewsViewModel createViewModel = ToViewModel(model);

            return(Ok(createViewModel));
        }