Пример #1
0
        public ActionResult AdminArtist()
        {
            dustEntities ORM = new dustEntities();

            ViewBag.Artistinfo = ORM.artistinformations;
            return(View());
        }
Пример #2
0
        public ActionResult AddArtist(artistinformation newArtist)
        {
            dustEntities ORM = new dustEntities();

            ORM.artistinformations.Add(newArtist);
            ORM.SaveChanges();
            return(RedirectToActionPermanent("AdminArtist"));
        }
Пример #3
0
        public ActionResult SearchAdminArtistByName(string name)
        {
            dustEntities ORM = new dustEntities();//need this is every operation that takes in information

            ViewBag.Artistinfo = ORM.artistinformations.Where(x => x.artistname.ToLower().Contains(name.ToLower()) || x.genre.ToLower().Contains(name.ToLower())).ToList();

            return(View("AdminArtist"));
        }
Пример #4
0
        public ActionResult Edit(int artistid)
        {
            dustEntities      ORM        = new dustEntities();
            artistinformation Artistedit = ORM.artistinformations.Find(artistid);

            if (Artistedit == null)
            {
                return(RedirectToAction("AdminArtist"));
            }
            ViewBag.Artistedit = Artistedit;
            return(View());
        }
Пример #5
0
        public ActionResult SaveChanges(artistinformation UpdatedItem)
        {
            dustEntities ORM = new dustEntities(); //need this is every operation that takes in information
            //find the old record
            artistinformation OldRecord = ORM.artistinformations.Find(UpdatedItem.artistid);

            //ToDo check for null
            OldRecord.soundcloud       = UpdatedItem.soundcloud;
            OldRecord.website          = UpdatedItem.website;
            OldRecord.genre            = UpdatedItem.genre;
            OldRecord.spotify          = UpdatedItem.spotify;
            OldRecord.youtube          = UpdatedItem.youtube;
            OldRecord.email            = UpdatedItem.email;
            OldRecord.twitter          = UpdatedItem.twitter;
            OldRecord.instagram        = UpdatedItem.instagram;
            OldRecord.facebook         = UpdatedItem.facebook;
            OldRecord.popularcity      = UpdatedItem.popularcity;
            ORM.Entry(OldRecord).State = System.Data.Entity.EntityState.Modified;
            ORM.SaveChanges();

            return(RedirectToAction("AdminArtist"));
        }