예제 #1
0
        public ArtistBase 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, ArtistBase>(addedItem));
        }
예제 #2
0
        public ActionResult Create(ArtistAdd newItem)
        {
            newItem.Executive = HttpContext.User.Identity.Name;

            // Validate the input
            if (!ModelState.IsValid)
            {
                return(View(newItem));
            }

            // Process the input
            var addedItem = m.ArtistAdd(newItem);

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