Ejemplo n.º 1
0
 public bool DeleteEmployee(int id)
 {
     using (var contest = new PrkStoreEntities())
     {
         var employee = contest.tblProduct.FirstOrDefault(x => x.Id == id);
         if (employee != null)
         {
             contest.tblProduct.Remove(employee);
             contest.SaveChanges();
             return(true);
         }
         return(false);
     }
 }
        public CategoryModal GetOne(int id)
        {
            using (var database = new PrkStoreEntities())
            {
                var all = database.tblCategory.Where(x => x.ID == id).
                          Select(X => new CategoryModal
                {
                    Name        = X.Name,
                    Description = X.Description
                }).FirstOrDefault();

                return(all);
            }
        }
Ejemplo n.º 3
0
        public ProductModals GetOne(int id)
        {
            using (var database = new PrkStoreEntities())
            {
                var all = database.tblProduct.Where(x => x.Id == id).
                          Select(X => new ProductModals
                {
                    Name        = X.Name,
                    Description = X.Description
                }).FirstOrDefault();

                return(all);
            }
        }
Ejemplo n.º 4
0
        //public  static  ConfigurationServices classObject { get
        //    {
        //        if (privateInmemory == null)
        //        {
        //            privateInmemory = new ConfigurationServices();
        //        }

        //        return classObject;


        //    } } // arko class bata get garna milos vanera
        //private static   ConfigurationServices privateInmemory { get; set; }


        //private ConfigurationServices()
        //{


        //}


        public config GetConfig(string key)
        {
            using (var database = new PrkStoreEntities())
            {
                {
                    var all = database.tblConfigurations.Where(x => x.Key == key).
                              Select(x => new config

                    {
                        value = x.value
                    }).FirstOrDefault();
                    return(all);
                }
            }
        }
Ejemplo n.º 5
0
 public bool Edit(int id, ProductModals models)
 {
     using (var contest = new PrkStoreEntities())
     {
         var employee = contest.tblProduct.FirstOrDefault(x => x.Id == id);// first or default use garda fast hucha where vanda
         if (employee != null)
         {
             employee.Name        = models.Name;
             employee.Description = models.Description;
             employee.Price       = models.Price;
         }
         contest.SaveChanges();
         return(true);
     }
 }
Ejemplo n.º 6
0
        public List <ProductModals> GetOne(List <int> ids)
        {
            using (var database = new PrkStoreEntities())
            {
                var all = database.tblProduct.Where(product => ids.Contains(product.Id)).
                          Select(X => new ProductModals
                {
                    Name        = X.Name,
                    Description = X.Description,
                    Price       = (decimal)X.Price
                }).ToList();

                return(all);
            }
        }
Ejemplo n.º 7
0
 public int Save(ProductModals modal)
 {
     using (var database = new PrkStoreEntities())
     {
         tblProduct CategoryTB = new tblProduct()
         {
             Name        = modal.Name,
             Description = modal.Description,
             Price       = modal.Price
         };
         database.tblProduct.Add(CategoryTB);
         database.SaveChanges();
         return(CategoryTB.Id);
     }
 }
 public bool Edit(int id, CategoryModal models)
 {
     using (var contest = new PrkStoreEntities())
     {
         var employee = contest.tblCategory.FirstOrDefault(x => x.ID == id);// first or default use garda fast hucha where vanda
         if (employee != null)
         {
             employee.Name        = models.Name;
             employee.Description = models.Description;
             employee.IsFeatured  = models.IsFeatured;
         }
         contest.SaveChanges();
         return(true);
     }
 }
        public List <CategoryModal> GetAll()
        {
            using (var database = new PrkStoreEntities())
            {
                var all = database.tblCategory.Select(X => new CategoryModal()
                {
                    ID          = X.ID,
                    Name        = X.Name,
                    Description = X.Description,
                    ImageUrl    = X.ImageUrl,
                    IsFeatured  = (bool)X.IsFeatured
                }).ToList();

                return(all);
            }
        }
        public int Save(CategoryModal modal)
        {
            using (var database = new PrkStoreEntities())
            {
                tblCategory CategoryTB = new tblCategory()
                {
                    Name        = modal.Name,
                    Description = modal.Description,
                    ImageUrl    = modal.ImageUrl,
                    IsFeatured  = modal.IsFeatured
                };

                database.tblCategory.Add(CategoryTB);
                database.SaveChanges();
                return(CategoryTB.ID);
            }
        }
Ejemplo n.º 11
0
        public List <ProductModals> GetAll(int pageno)
        {
            int pageSize = 5;

            using (var database = new PrkStoreEntities())
            {
                var all = database.tblProduct.OrderBy(x => x.Id).Skip((pageno - 1) * pageSize).Take(pageSize)
                          .Select(X => new ProductModals()
                {
                    Id          = X.Id,
                    Name        = X.Name,
                    Description = X.Description,
                    Price       = (decimal)X.Price,
                    pagenumber  = pageno,
                    one         = 1,
                }).ToList();


                return(all);
            }
        }