Esempio n. 1
0
        // Add artist
        public ArtistBase AddArtist(ArtistAdd newItem)
        {
            var addedItem = ds.Artists.Add(Mapper.Map<Artist>(newItem));
            ds.SaveChanges();

            return (addedItem == null) ? null : Mapper.Map<ArtistBase>(addedItem);
        }
Esempio n. 2
0
        public ActionResult Create(ArtistAdd newItem)
        {
            if (ModelState.IsValid)
            {
                ArtistBase addItem = m.AddArtist(newItem);
            }

            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public ArtistBase AddArtist(ArtistAdd newItem)
        {
            var addedItem = Mapper.Map <Artist>(newItem);

            ds.Artists.Add(addedItem);
            ds.SaveChanges();

            return(Mapper.Map <ArtistBase>(addedItem));
        }
Esempio n. 4
0
 public ActionResult Create(ArtistAdd newItem)
 {
     if (!ModelState.IsValid)
     {
         return(RedirectToAction("error"));
     }
     else
     {
         var addedItem = m.AddArtists(newItem);
         return(RedirectToAction("index"));
     }
 }
Esempio n. 5
0
        public ArtistBase AddArtists(ArtistAdd newItem)
        {
            ArtistBase result;

            var addedItem = new Artist();

            addedItem = Mapper.Map <Artist>(newItem);
            ds.Artists.Add(addedItem);
            ds.SaveChanges();

            result = Mapper.Map <ArtistBase>(addedItem);

            // Return the result
            return(result);
        }
        public ActionResult Create(ArtistAdd newItem)
        {
            if (ModelState.IsValid)
            {
                // Attempt to add the item
                var addedItem = m.AddArtist(newItem);

                if (addedItem == null)
                {
                    return RedirectToAction("Index");
                }
                else
                {
                    return RedirectToAction("Index");
                }
            }
            else
            {
                return View();
            }
        }