public void AnularVenta(int id) { var ven = v.Ventas.Where(d => d.IdVenta == id) .FirstOrDefault(); v.Ventas.Remove(ven); v.SaveChanges(); }
public void Create(Login login) { using (var db = new PlayContext()) { db.Logins.Add(login); db.SaveChanges(); } }
public void Create(Order order) { using (var db = new PlayContext()) { db.Orders.Add(order); db.SaveChanges(); } }
public ActionResult Eliminar(int id) { var prodd = context.Productos.Where(d => d.IdProducto == id).FirstOrDefault(); context.Productos.Remove(prodd); context.SaveChanges(); return(View(prodd)); }
public void DeleteAPlay(int playId) { using (var db = new PlayContext()) { selectedPlay = db.Plays.Where(p => p.PlayId == playId).FirstOrDefault(); db.Plays.Remove(selectedPlay); db.SaveChanges(); } }
public void DeleteExistingAuthor(int authorId) { using (var db = new PlayContext()) { selectedAuthor = db.Authors.Where(a => a.AuthorId == authorId).FirstOrDefault(); db.Authors.Remove(selectedAuthor); db.SaveChanges(); } }
public void DeleteExistingTheatre(int theatreId) { using (var db = new PlayContext()) { SelectedTheatre = db.Theatres.Where(t => t.TheatreId == theatreId).FirstOrDefault(); db.Remove(SelectedTheatre); db.SaveChanges(); } }
public void UpdateExistingAuthor(int authorId, string firstName, string lastName) { using (var db = new PlayContext()) { selectedAuthor = db.Authors.Where(a => a.AuthorId == authorId).FirstOrDefault(); selectedAuthor.FirstName = firstName; selectedAuthor.LastName = lastName; db.SaveChanges(); } }
public void UpdateExistingTheatre(int theatreId, string name, string location, int capacity) { using (var db = new PlayContext()) { SelectedTheatre = db.Theatres.Where(t => t.TheatreId == theatreId).FirstOrDefault(); SelectedTheatre.Name = name; SelectedTheatre.Location = location; SelectedTheatre.Capacity = capacity; db.SaveChanges(); } }
public void DeletePlay() { using (var db = new PlayContext()) { var plays = db.Plays.ToList(); plays.Reverse(); var lastPlay = plays[0]; db.Plays.Remove(lastPlay); db.SaveChanges(); } }
public void Update(int orderId) { using (var db = new PlayContext()) { var order = db.Orders.First(q => q.Id == orderId); order.IsPaid = true; db.Entry(order).State = EntityState.Modified; db.SaveChanges(); } }
public void DeleteAuthor() { using (var db = new PlayContext()) { var authors = db.Authors.ToList(); authors.Reverse(); var lastAuthor = authors[0]; db.Authors.Remove(lastAuthor); db.SaveChanges(); } }
public void DeleteTheatre() { using (var db = new PlayContext()) { var theatres = db.Theatres.ToList(); theatres.Reverse(); var lastTheatre = theatres[0]; db.Theatres.Remove(lastTheatre); db.SaveChanges(); } }
public void RemoveRange(IEnumerable <int> ordersToRemoveIds) { using (var db = new PlayContext()) { var ordersToCancel = db.Orders .Where(q => ordersToRemoveIds.Contains(q.Id)); db.Orders.RemoveRange(ordersToCancel); db.SaveChanges(); } }
public void CreateAAuthor(string firstName, string lastName) { using (var db = new PlayContext()) { db.Add(new Author { FirstName = firstName, LastName = lastName }); db.SaveChanges(); } }
public void CreateATheatre(string name, string location, int capacity) { using (var db = new PlayContext()) { db.Add(new Theatre { Name = name, Location = location, Capacity = capacity }); db.SaveChanges(); } }
public void UpdateAPlay(int playId, string title, string bio, string genre, object author, object theatre) { int?theatreObjId = null; if (theatre != null) { theatreObjId = ((Theatre)theatre).TheatreId; } ; using (var db = new PlayContext()) { selectedPlay = db.Plays.Where(p => p.PlayId == playId).FirstOrDefault(); selectedPlay.Title = title; selectedPlay.Bio = bio; selectedPlay.Genre = genre; selectedPlay.AuthorId = ((Author)author).AuthorId; selectedPlay.TheatreId = theatreObjId; db.SaveChanges(); } }
public void CreateAPlay(string title, string bio, string genre, object author, object theatre) { int?theatreObjId = null; if (theatre != null) { theatreObjId = ((Theatre)theatre).TheatreId; } ; using (var db = new PlayContext()) { db.Add(new Play { Title = title, Bio = bio, Genre = genre, AuthorId = ((Author)author).AuthorId, TheatreId = theatreObjId }); db.SaveChanges(); } }
public void AgregarTienda(Tienda tienda) { t.Tiendas.Add(tienda); t.SaveChanges(); }
public void GuardarRepresentante(Representante repre) { r.Representantes.Add(repre); r.SaveChanges(); }
public void GuardarPro(Producto pr) { p.Productos.Add(pr); p.SaveChanges(); }
public RedirectToRouteResult Actuali(Representante re) { serviRe.ActualizarRepresentante(re); context.SaveChanges(); return(RedirectToAction("Index")); }
public void Agregar(DetalleVenta deta) { d.Detalles.Add(deta); d.SaveChanges(); }