コード例 #1
0
        public bool UpdateArmchair(Armchair armchair)
        {
            using (HorecaMebelEntities db = new HorecaMebelEntities())
            {
                var armchairFromDB = db.Armchairs.FirstOrDefault(x => x.id == armchair.id);

                armchairFromDB.Name = armchair.Name;

                armchairFromDB.ImagePath = armchair.ImagePath;
                armchairFromDB.Price     = armchair.Price;

                armchairFromDB.NewPrice   = armchair.NewPrice;
                armchairFromDB.Descrption = armchair.Descrption;

                armchairFromDB.WoodenFrame = armchair.WoodenFrame;
                armchairFromDB.Seat        = armchair.Seat;
                armchairFromDB.Back        = armchair.Back;

                armchairFromDB.Width = armchair.Width;

                armchairFromDB.Height = armchair.Height;

                armchairFromDB.Depth = armchair.Depth;

                armchairFromDB.Legs           = armchair.Legs;
                armchairFromDB.Skin           = armchair.Skin;
                armchairFromDB.ProductionTime = armchair.ProductionTime;

                armchairFromDB.SkinColour = armchair.SkinColour;

                db.SaveChanges();
                return(true);
            }
        }
コード例 #2
0
        public bool UpdateSofa(Sofa sofa)
        {
            using (HorecaMebelEntities db = new HorecaMebelEntities())
            {
                var sofaFromDB = db.Sofas.FirstOrDefault(x => x.id == sofa.id);

                sofaFromDB.Name = sofa.Name;

                sofaFromDB.ImagePath = sofa.ImagePath;
                sofaFromDB.Price     = sofa.Price;

                sofaFromDB.NewPrice    = sofa.NewPrice;
                sofaFromDB.Description = sofa.Description;

                sofaFromDB.WoodenFrame = sofa.WoodenFrame;
                sofaFromDB.Seat        = sofa.Seat;
                sofaFromDB.Back        = sofa.Back;

                sofaFromDB.Width = sofa.Width;

                sofaFromDB.Height = sofa.Height;

                sofaFromDB.Depth = sofa.Depth;

                sofaFromDB.Legs = sofa.Legs;
                sofaFromDB.Skin = sofa.Skin;

                sofaFromDB.ProductionTime = sofa.ProductionTime;

                sofaFromDB.SkinColour = sofa.SkinColour;

                db.SaveChanges();
                return(true);
            }
        }
コード例 #3
0
        public bool UpdateCubeSeat(CubeSeat cubeSeat)
        {
            using (HorecaMebelEntities db = new HorecaMebelEntities())
            {
                var cubeSeatFromDB = db.CubeSeats.FirstOrDefault(x => x.id == cubeSeat.id);

                cubeSeatFromDB.Name = cubeSeat.Name;

                cubeSeatFromDB.ImagePath = cubeSeat.ImagePath;
                cubeSeatFromDB.Price     = cubeSeat.Price;

                cubeSeatFromDB.NewPrice    = cubeSeat.NewPrice;
                cubeSeatFromDB.Description = cubeSeat.Description;

                cubeSeatFromDB.WoodenFrame = cubeSeat.WoodenFrame;
                cubeSeatFromDB.Seat        = cubeSeat.Seat;

                cubeSeatFromDB.Width = cubeSeat.Width;

                cubeSeatFromDB.Height = cubeSeat.Height;

                cubeSeatFromDB.Depth = cubeSeat.Depth;

                cubeSeatFromDB.Legs = cubeSeat.Legs;
                cubeSeatFromDB.Skin = cubeSeat.Skin;

                cubeSeatFromDB.ProductionTime = cubeSeat.ProductionTime;

                cubeSeatFromDB.SkinColour = cubeSeat.SkinColour;
                db.SaveChanges();
                return(true);
            }
        }
コード例 #4
0
        public void AddArmchairAdditionImage(int armchairId, string imagePath)
        {
            var model = new ArmchairsAdditionalPhoto();

            model.ArmchairId = armchairId;
            model.Imagepath  = imagePath;
            using (HorecaMebelEntities db = new HorecaMebelEntities())
            {
                db.ArmchairsAdditionalPhotoes.Add(model);

                db.SaveChanges();
            }
        }
コード例 #5
0
        public void AddSofaAdditionImage(int sofaId, string imagePath)
        {
            var model = new SofaAdditionalPhoto();

            model.SofaId    = sofaId;
            model.ImagePath = imagePath;
            using (HorecaMebelEntities db = new HorecaMebelEntities())
            {
                db.SofaAdditionalPhotoes.Add(model);

                db.SaveChanges();
            }
        }
コード例 #6
0
        public void AddCubeSeatAdditionImage(int cubeSeatId, string imagePath)
        {
            var model = new CubeSeatAdditionalPhoto();

            model.CubeSeatId = cubeSeatId;
            model.ImagePath  = imagePath;
            using (HorecaMebelEntities db = new HorecaMebelEntities())
            {
                db.CubeSeatAdditionalPhotoes.Add(model);

                db.SaveChanges();
            }
        }
コード例 #7
0
 public List <string> AllAdditionalImagesByArmchairId(int armchairId)
 {
     try
     {
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             return(db.ArmchairsAdditionalPhotoes.Where(x => x.ArmchairId == armchairId).Select(x => x.Imagepath).ToList());
         }
     }
     catch (Exception)
     {
         return(new List <string>());
     }
 }
コード例 #8
0
 public List <ChairsAdditionalPhoto> LoadAllAdditionalImagesChair(int chairId)
 {
     try
     {
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             return(db.ChairsAdditionalPhotoes.Where(x => x.ChairId == chairId).ToList());
         }
     }
     catch (Exception ex)
     {
         return(new List <ChairsAdditionalPhoto>());
     }
 }
コード例 #9
0
 public List <string> AllAdditionalImagesBySofaId(int sofaId)
 {
     try
     {
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             return(db.SofaAdditionalPhotoes.Where(x => x.SofaId == sofaId).Select(x => x.ImagePath).ToList());
         }
     }
     catch (Exception)
     {
         return(new List <string>());
     }
 }
コード例 #10
0
 public List <Reference> AllReferences()
 {
     try
     {
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             return(db.References.ToList());
         }
     }
     catch (Exception ex)
     {
         return(new List <Reference>());
     }
 }
コード例 #11
0
 public List <Order> GetAllInActiveOrders()
 {
     try
     {
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             return(db.Orders.Where(x => x.IsActive == false).ToList());
         }
     }
     catch (Exception ex)
     {
         return(new List <Order>());
     }
 }
コード例 #12
0
 public Promotion LoadById(int id)
 {
     try
     {
         Promotion result = new Promotion();
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             return(db.Promotions.Where(x => x.id == id).FirstOrDefault());
         }
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #13
0
 public List <ArmchairsAdditionalPhoto> LoadAllAdditionalImages(int id)
 {
     try
     {
         List <ArmchairsAdditionalPhoto> result = new List <ArmchairsAdditionalPhoto>();
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             result.AddRange(db.ArmchairsAdditionalPhotoes.Where(x => x.ArmchairId == id).ToList());
         }
         return(result);
     }
     catch (Exception)
     {
         return(new List <ArmchairsAdditionalPhoto>());
     }
 }
コード例 #14
0
        public Armchair LoadArmchairById(int id)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    var armchair = db.Armchairs.FirstOrDefault(x => x.id == id);

                    return(armchair);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #15
0
        public Chair Edit(int id)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    var chair = db.Chairs.FirstOrDefault(x => x.id == id);

                    return(chair);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #16
0
 public List <Sofa> AllSofas()
 {
     try
     {
         List <Sofa> result = new List <Sofa>();
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             result.AddRange(db.Sofas.ToList());
         }
         return(result);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #17
0
        public void DeleteAdditionalImageFromSofa(int id)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    var sofaAdditionalImage = db.SofaAdditionalPhotoes.FirstOrDefault(x => x.id == id);

                    db.SofaAdditionalPhotoes.Remove(sofaAdditionalImage);

                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            { }
        }
コード例 #18
0
 public List <CubeSeatAdditionalPhoto> LoadAllAdditionalImagesCubeSeat(int cubeSeatId)
 {
     try
     {
         List <CubeSeatAdditionalPhoto> result = new List <CubeSeatAdditionalPhoto>();
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             result.AddRange(db.CubeSeatAdditionalPhotoes.Where(x => x.CubeSeatId == cubeSeatId).ToList());
         }
         return(result);
     }
     catch (Exception)
     {
         return(new List <CubeSeatAdditionalPhoto>());
     }
 }
コード例 #19
0
        public CubeSeat LoadCubeSeatById(int id)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    var cubeSeat = db.CubeSeats.FirstOrDefault(x => x.id == id);

                    return(cubeSeat);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #20
0
 public List <SofaAdditionalPhoto> LoadAllAdditionalImagesSofa(int sofaId)
 {
     try
     {
         List <SofaAdditionalPhoto> result = new List <SofaAdditionalPhoto>();
         using (HorecaMebelEntities db = new HorecaMebelEntities())
         {
             result.AddRange(db.SofaAdditionalPhotoes.Where(x => x.SofaId == sofaId).ToList());
         }
         return(result);
     }
     catch (Exception)
     {
         return(new List <SofaAdditionalPhoto>());
     }
 }
コード例 #21
0
        public Sofa LoadSofaById(int id)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    var sofa = db.Sofas.FirstOrDefault(x => x.id == id);

                    return(sofa);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #22
0
        public bool Save(Promotion promotion)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    db.Promotions.Add(promotion);
                    db.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);;
            }
        }
コード例 #23
0
        public bool SaveCubeSeat(CubeSeat cubeSeat)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    db.CubeSeats.Add(cubeSeat);

                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #24
0
        public List <CubeSeat> AllCubeSeat()
        {
            try
            {
                List <CubeSeat> result = new List <CubeSeat>();
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    result.AddRange(db.CubeSeats.ToList());
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #25
0
        public List <Promotion> All()
        {
            try
            {
                List <Promotion> result = new List <Promotion>();
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    result.AddRange(db.Promotions.ToList());
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #26
0
        public List <Armchair> AllArmchairs()
        {
            try
            {
                List <Armchair> result = new List <Armchair>();
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    result.AddRange(db.Armchairs.ToList());
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(new List <Armchair>());
            }
        }
コード例 #27
0
        public bool SaveArmchair(Armchair chair)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    db.Armchairs.Add(chair);

                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #28
0
        public bool SaveSofa(Sofa sofa)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    db.Sofas.Add(sofa);

                    db.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #29
0
        public Guid?SaveOrderDetails(string title, string firstName, string lastName, string address, string city, string postCode,
                                     string country, string company, string vat, string phone, string email, string freeText,
                                     double furniture, double transport, double dds, double fullPrice)
        {
            try
            {
                Order order = new Order();

                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    order.order_Guid    = Guid.NewGuid().ToString();
                    order.Title         = title;
                    order.FirstName     = firstName;
                    order.LastName      = lastName;
                    order.Address       = address;
                    order.PostCode      = postCode;
                    order.City          = city;
                    order.Country       = country;
                    order.Company       = company;
                    order.VAT           = vat;
                    order.Phone         = phone;
                    order.Email         = email;
                    order.Comment       = freeText;
                    order.IsActive      = true;
                    order.OrderDateTime = DateTime.Now;

                    order.FurniturePrice = furniture;
                    order.TransportPrice = transport;
                    order.DDSPrice       = dds;
                    order.FullPrice      = fullPrice;

                    db.Orders.Add(order);
                    db.SaveChanges();
                }

                return(new Guid(order.order_Guid));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #30
0
        public bool DeleteCubeSeat(int id)
        {
            try
            {
                using (HorecaMebelEntities db = new HorecaMebelEntities())
                {
                    var cubeSeat = db.CubeSeats.FirstOrDefault(x => x.id == id);

                    db.CubeSeats.Remove(cubeSeat);

                    db.SaveChanges();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                return(false);
            }
        }