public IHttpActionResult PutEventDetail(long id, EventDetail eventDetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eventDetail.EventDetailID) { return(BadRequest()); } db.Entry(eventDetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EventDetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "EventID,TounamentID,EventName,EventNumber,EventDateTime,EventEndDateTime,AutoClose")] Event @event) { if (ModelState.IsValid) { db.Events.Add(@event); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TounamentID = new SelectList(db.Tournaments, "TounamentID", "TournamentName", @event.TounamentID); return(View(@event)); }
public ActionResult Create([Bind(Include = "EventDetailID,EventID,EventDetailStatusID,EventDetailName,EventDetailNumber,EventDetailOdd,FinishingPosition,FirsTimer")] EventDetail eventDetail) { if (ModelState.IsValid) { db.EventDetails.Add(eventDetail); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EventID = new SelectList(db.Events, "EventID", "EventName", eventDetail.EventID); return(View(eventDetail)); }
public IHttpActionResult DeleteEventDetail(EventDetail _eventDetail) { using (HollywoodTestEntities1 db = new HollywoodTestEntities1()) { int eventN = Convert.ToInt32(_eventDetail.EventDetailID); EventDetail eventdetail = (from ev in db.EventDetails where ev.EventDetailID == _eventDetail.EventDetailID select ev).FirstOrDefault(); db.EventDetails.Remove(eventdetail); db.SaveChanges(); } return(Ok("")); }
public ActionResult Edit([Bind(Include = "EventDetailStatusID,EventDetailStatusName")] EventDetailStatus @event) { try { db.Entry(@event).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public string CreateTournament(Tournament tournament) { if (!ModelState.IsValid) { return("Model is invalid"); } db.Tournaments.Add(tournament); db.SaveChanges(); return("Tourname is created"); }
// GET: Tournaments/Delete/5 public ActionResult DeleteEvent(int[] EventIDs) { try { using (HollywoodTestEntities1 entities = new HollywoodTestEntities1()) { foreach (int EventId in EventIDs) { Tournament events = (from Ev in entities.Tournaments where Ev.TounamentID == EventId select Ev).FirstOrDefault(); entities.Tournaments.Remove(events); } entities.SaveChanges(); } return(new EmptyResult()); } catch { return(View()); } }