Пример #1
0
        public IHttpActionResult Create([FromBody] AlbumViewModel albumModel)
        {
            if (!this.ModelState.IsValid)
            {
                return(BadRequest(this.ModelState));
            }

            var album = AlbumViewModel.FromViewModelToData(albumModel);

            this.Data.Albums.Add(album);
            this.Data.SaveChanges();

            return(Created(this.Url.ToString(), album));
        }