Beispiel #1
0
        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();
     }
 }
Beispiel #4
0
        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();
     }
 }
Beispiel #6
0
 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();
     }
 }
Beispiel #7
0
 public void DeleteExistingTheatre(int theatreId)
 {
     using (var db = new PlayContext())
     {
         SelectedTheatre = db.Theatres.Where(t => t.TheatreId == theatreId).FirstOrDefault();
         db.Remove(SelectedTheatre);
         db.SaveChanges();
     }
 }
Beispiel #8
0
 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();
     }
 }
Beispiel #9
0
 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();
     }
 }
Beispiel #10
0
 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();
            }
        }
Beispiel #12
0
 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();
     }
 }
Beispiel #13
0
 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();
            }
        }
Beispiel #15
0
 public void CreateAAuthor(string firstName, string lastName)
 {
     using (var db = new PlayContext())
     {
         db.Add(new Author
         {
             FirstName = firstName,
             LastName  = lastName
         });
         db.SaveChanges();
     }
 }
Beispiel #16
0
 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();
            }
        }
Beispiel #19
0
 public void AgregarTienda(Tienda tienda)
 {
     t.Tiendas.Add(tienda);
     t.SaveChanges();
 }
 public void GuardarRepresentante(Representante repre)
 {
     r.Representantes.Add(repre);
     r.SaveChanges();
 }
Beispiel #21
0
 public void GuardarPro(Producto pr)
 {
     p.Productos.Add(pr);
     p.SaveChanges();
 }
 public RedirectToRouteResult Actuali(Representante re)
 {
     serviRe.ActualizarRepresentante(re);
     context.SaveChanges();
     return(RedirectToAction("Index"));
 }
Beispiel #23
0
 public void Agregar(DetalleVenta deta)
 {
     d.Detalles.Add(deta);
     d.SaveChanges();
 }