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)); }
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 })); } }