Esempio n. 1
0
        public ArtistWithDetails ArtistAdd(ArtistAdd newItem)
        {
            var addedItem = ds.Artists.Add(mapper.Map <ArtistAdd, Artist>(newItem));

            // Configure the user name
            addedItem.Executive = User.Name;

            ds.SaveChanges();

            return((addedItem == null) ? null : mapper.Map <Artist, ArtistWithDetails>(addedItem));
        }
Esempio n. 2
0
        public ArtistBase ArtistAdd(ArtistAdd newItem)
        {
            var addGenre = ds.Genres.Find(newItem.GenreId);

            var addedItem = ds.Artists.Add(Mapper.Map <ArtistAdd, Artist>(newItem));

            addedItem.Genre = addGenre.Name;

            ds.SaveChanges();

            return((addedItem == null) ? null : Mapper.Map <Artist, ArtistBase>(addedItem));
        }
Esempio n. 3
0
        //[Authorize(Roles = "Executive")]
        public ActionResult Create(ArtistAdd newItem)
        {
            // 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 }));
            }
        }
Esempio n. 4
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 }));
            }
        }