Пример #1
0
        public ArtistWithDetail ArtistAdd(ArtistAdd newItem)
        {
            var addedItem = ds.Artists.Add(mapper.Map <ArtistAdd, Artist>(newItem));

            addedItem.Executive = UserAccount.Name;
            ds.SaveChanges();
            return((addedItem == null) ? null : mapper.Map <Artist, ArtistWithDetail>(addedItem));
        }
Пример #2
0
        public ActionResult Create(ArtistAdd newItem)
        {
            if (!ModelState.IsValid)
            {
                return(View(newItem));
            }
            var addedItem = m.ArtistAdd(newItem);

            if (addedItem == null)
            {
                return(View(newItem));
            }
            else
            {
                return(RedirectToAction("details", new { id = addedItem.Id }));
            }
        }