public ActionResult Nuevo(Ticket ticket) { context.Tickets.Add(ticket); context.SaveChanges(); return(RedirectToAction("Index")); }
public void Delete(int id) { var existing = GetByID(id); table.Remove(existing); _TicketsContext.SaveChanges(); }
public IActionResult DeletedEvent(int eventid) { _context.TicketsModel.Where(p => p.event_id == eventid) .ToList().ForEach(p => _context.TicketsModel.Remove(p)); _context.SaveChanges(); return(RedirectToAction("Index", "EventsModels")); }
public bool EditTicket(Ticket ticket) { try { using (var db = new TicketsContext(Manager)) { var ticketObj = db.Tickets.Where(i => i.IdTicket == ticket.IdTicket).FirstOrDefault(); if (ticketObj != null) { ticketObj.Usuario = ticket.Usuario; ticketObj.FechaActualizacion = DateTime.Now; ticketObj.Status = ticket.Status; db.Tickets.Update(ticketObj); db.SaveChanges(); return(true); } else { return(false); } } } catch (Exception ex) { return(false); } }
public void Create(Reservation reservation) { using (var ctx = new TicketsContext()) { ctx.Reservations.Add(reservation); ctx.SaveChanges(); } }
public void DeleteAgency(Data.Entities.Agency agency) { using (var ctx = new TicketsContext()) { ctx.Agencies.Remove(agency); ctx.SaveChanges(); } }
public void DeleteTrain(Data.Entities.Train train) { using (var ctx = new TicketsContext()) { ctx.Trains.Remove(train); ctx.SaveChanges(); } }
public void CreateTrain(Data.Entities.Train train) { using (var ctx = new TicketsContext()) { ctx.Trains.Add(train); ctx.SaveChanges(); } }
public void CreateRun(Data.Entities.Run run) { using (var ctx = new TicketsContext()) { ctx.Runs.Add(run); ctx.SaveChanges(); } }
public void Create(Data.Entities.Ticket ticket) { using (var ctx = new TicketsContext()) { ctx.Tickets.Add(ticket); ctx.SaveChanges(); } }
public void DeleteRun(int runId) { using (var ctx = new TicketsContext()) { var run = ctx.Runs.Find(runId); ctx.Runs.Remove(run); ctx.SaveChanges(); } }
public void UpdateTrain(Data.Entities.Train train) { using (var ctx = new TicketsContext()) { ctx.Trains.Attach(train); ctx.Entry(train).State = EntityState.Modified; ctx.SaveChanges(); } }
public void Update(Data.Entities.Ticket ticket) { using (var ctx = new TicketsContext()) { ctx.Tickets.Attach(ticket); ctx.Entry(ticket).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } }
public void UpdateAgency(Data.Entities.Agency agency) { using (var ctx = new TicketsContext()) { ctx.Agencies.Attach(agency); ctx.Entry(agency).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } }
public void Update(Reservation reservation) { using (var ctx = new TicketsContext()) { ctx.Reservations.Attach(reservation); ctx.Entry(reservation).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } }
public ActionResult Sell(int id, int count, string price) { var email = User.Identity.GetUserName(); var order = db.Orders.First(x => x.Id == id && x.Email == email); Change item = new Change(); item.Count = count; item.Price = int.Parse(price); item.OrderId = id; item.Email = email; item.EventId = order.EventId; db.TicketsToChange.Add(item); order.Count -= count; if (order.Count == 0) { db.Orders.Remove(order); } db.SaveChanges(); return(View(item)); }
public ActionResult Add(int eventId) { var email = User.Identity.GetUserName(); var items = db.ItemEvents.Where(x => x.EventId == eventId && x.Email == email).ToList(); ItemEvent item = new ItemEvent(); if (items.Count() > 0) { item = items.First(); db.Entry(item).State = EntityState.Modified; } else { item.EventId = eventId; item.Quantity = 1; item.Email = email; db.ItemEvents.Add(item); } db.SaveChanges(); return(RedirectToAction("Index", "Cart", item)); }
public ActionResult Create([Bind(Include = "Id,Name,Artist,Date,City,Place,Price,Count,CategoryId")] Event _event, HttpPostedFileBase upload) { if (upload != null) { string fileName = System.IO.Path.GetFileName(upload.FileName); if (CheckByGraphicsFormat(fileName)) { SaveImage(upload, fileName); _event.ImageUrl = fileName; } else { _event.ImageUrl = "event.jpg"; } } if (!ModelState.IsValid) { return(View(_event)); } db.Events.Add(_event); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool DeleteTicket(int Id) { try { using (var db = new TicketsContext(Manager)) { var ticket = db.Tickets.Where(i => i.IdTicket == Id).FirstOrDefault(); db.Tickets.Remove(ticket); db.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public bool CreateTicket(Ticket ticket) { try { using (var db = new TicketsContext(Manager)) { Ticket modelTicket = new Ticket(); modelTicket.Usuario = ticket.Usuario; modelTicket.FechaCreacion = DateTime.Now; modelTicket.FechaActualizacion = DateTime.Now; modelTicket.Status = "Abierto"; db.Tickets.Add(modelTicket); db.SaveChanges(); return(true); } } catch (Exception ex) { return(false); } }
public void save() { _TicketsContext.SaveChanges(); }
public void Add(TEntity obj) { Db.Set <TEntity>().Add(obj); Db.SaveChanges(); }