Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ArtistGig artistGig = db.ArtistGigs.Find(id);

            db.ArtistGigs.Remove(artistGig);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "ArtistGigID,ArtistID,GigID")] ArtistGig artistGig)
 {
     if (ModelState.IsValid)
     {
         db.Entry(artistGig).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ArtistID = new SelectList(db.Artists, "Id", "StageName", artistGig.ArtistID);
     ViewBag.GigID    = new SelectList(db.Gigs, "GigID", "Name", artistGig.GigID);
     return(View(artistGig));
 }
Пример #3
0
        // GET: ArtistGigs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ArtistGig artistGig = db.ArtistGigs.Find(id);

            if (artistGig == null)
            {
                return(HttpNotFound());
            }
            return(View(artistGig));
        }
Пример #4
0
        // GET: ArtistGigs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ArtistGig artistGig = db.ArtistGigs.Find(id);

            if (artistGig == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ArtistID = new SelectList(db.Artists, "Id", "StageName", artistGig.ArtistID);
            ViewBag.GigID    = new SelectList(db.Gigs, "GigID", "Name", artistGig.GigID);
            return(View(artistGig));
        }
Пример #5
0
        public ActionResult ApplyForGig(int id, string sortOrder, string currentFilter, string searchString)
        {
            var userid       = User.Identity.GetUserId();
            var dbcheck      = db.ArtistGigs.Where(a => a.ArtistID == userid && a.GigID == id);
            var dbcheckcount = dbcheck.Count();
            Gig gg           = db.Gigs.Find(id);

            if (dbcheckcount == 0 && gg != null)
            {
                ArtistGig artistGig = new ArtistGig
                {
                    ArtistID = userid,
                    GigID    = id
                };
                db.ArtistGigs.Add(artistGig);
                db.SaveChanges();
                return(RedirectToAction("Apply", new { sortOrder = sortOrder, currentFilter = currentFilter, searchString = searchString }));
            }

            return(RedirectToAction("Apply", new { sortOrder = sortOrder, currentFilter = currentFilter, searchString = searchString }));
        }