public IHttpActionResult PutTicket(int id, Ticket ticket) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ticket.TicketID) { return(BadRequest()); } db.Entry(ticket).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TicketExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "Id,Name,Location,StartDate,EndDate")] Event e) { if (ModelState.IsValid) { db.Entry(e).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(e)); }
public ActionResult Edit([Bind(Include = "PersonID,Name,Surname,DNI")] Person person) { if (ModelState.IsValid) { db.Entry(person).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(person)); }
public ActionResult Edit([Bind(Include = "CompanyID,Name,FoundedYear,Description")] EventCompany eventCompany) { if (ModelState.IsValid) { db.Entry(eventCompany).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(eventCompany)); }
public ActionResult Edit([Bind(Include = "CountryID,Name,Currency,Change")] Country country) { if (ModelState.IsValid) { db.Entry(country).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(country)); }
public ActionResult Edit([Bind(Include = "TransportID,TransportType,Capacity,Bathroom")] Transport transport) { if (ModelState.IsValid) { db.Entry(transport).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(transport)); }
public ActionResult Edit([Bind(Include = "CityID,CityName,CountryID")] City city) { if (ModelState.IsValid) { db.Entry(city).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "Name", city.CountryID); return(View(city)); }
public ActionResult Edit([Bind(Include = "EventWithTicketID,CityID,TransportID,EventDate,Description,Addres,HasTickets,MaxTicket")] EventWithTicket eventWithTicket) { if (ModelState.IsValid) { db.Entry(eventWithTicket).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CityID = new SelectList(db.Cities, "CityID", "CityName", eventWithTicket.CityID); ViewBag.TransportID = new SelectList(db.Transports, "TransportID", "TransportType", eventWithTicket.TransportID); return(View(eventWithTicket)); }
public async Task <ActionResult> Edit([Bind(Include = "TicketID,EventWithTicketID,Description")] Tick tick) { if (ModelState.IsValid) { db.Entry(tick).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.EventWithTicketID = new SelectList(db.EventsWithTickets, "EventWithTicketID", "Name", tick.EventWithTicketID); return(View(tick)); }
public async Task <ActionResult> Edit([Bind(Include = "ReservaID,TicketID,PersonID")] Ticket ticket) { if (ModelState.IsValid) { db.Entry(ticket).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.PersonID = new SelectList(db.Persons, "PersonID", "DNI", ticket.PersonID); ViewBag.TicketID = new SelectList(db.Ticks, "TicketID", "TicketID", ticket.TicketID); return(View(ticket)); }
public async Task <IActionResult> Delete(int?id) { if (id != null) { Event find_event = new Event { Id = id.Value }; EventsContext.Entry(find_event).State = EntityState.Deleted; await EventsContext.SaveChangesAsync(); return(RedirectToAction("Index")); } return(NotFound()); }
// PUT api/EventRecords/5 public HttpResponseMessage PutEventRecord(int id, EventRecord eventrecord) { if (ModelState.IsValid && id == eventrecord.Id) { db.Entry(eventrecord).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } }