public ActionResult DeleteConfirmed(string id)
        {
            DealCategory dealCategory = db.DealCategories.Find(id);

            db.DealCategories.Remove(dealCategory);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task UpdateDealCategory(DealCategory dealcategory)
        {
            var response = await httpService.Put(url, dealcategory);

            if (!response.Success)
            {
                throw new ApplicationException(await response.GetBody());
            }
        }
 public ActionResult Edit([Bind(Include = "DealCategoryId,DealCategoryName,BasicPrice")] DealCategory dealCategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dealCategory).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dealCategory));
 }
Example #4
0
        public bool CreateDealCategory(DealCategory objDealCategory)
        {
            objDealCategory.CreatedTS = DateTime.Now;
            objDealCategory.CreatedBy = "usernamexxx";
            objDealCategory.UpdatedTS = DateTime.Now;
            objDealCategory.UpdatedBy = "usernamexxx";

            _db.DealCategories.Add(objDealCategory);
            _db.SaveChanges();
            return(true);
        }
        public async Task <ActionResult> Put(DealCategory category)
        {
            category.CreatedBy             = "user";
            category.CreatedTS             = DateTime.UtcNow;
            category.UpdatedBy             = "user";
            category.UpdatedTS             = DateTime.UtcNow;
            context.Attach(category).State = EntityState.Modified;
            await context.SaveChangesAsync();

            return(NoContent());
        }
        public async Task <ActionResult <int> > Post(DealCategory category)
        {
            category.CreatedBy = "user";
            category.CreatedTS = DateTime.UtcNow;
            category.UpdatedBy = "user";
            category.UpdatedTS = DateTime.UtcNow;
            context.Add(category);
            await context.SaveChangesAsync();

            return(category.Id);
        }
        public ActionResult Create([Bind(Include = "DealCategoryId,DealCategoryName,BasicPrice")] DealCategory dealCategory)
        {
            if (ModelState.IsValid)
            {
                db.DealCategories.Add(dealCategory);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dealCategory));
        }
Example #8
0
        public bool Update(DealCategory category)
        {
            var request = new RestRequest(String.Format("deal_categories/{0}.xml", category.Id), Method.PUT)
            {
                XmlSerializer = new XmlIgnoreSerializer()
            };

            request.AddBody(category);

            var response = _client.Execute <DealCategory>(request);

            return(response.StatusCode == HttpStatusCode.OK);
        }
Example #9
0
        public DealCategory Create(DealCategory category)
        {
            var request = new RestRequest("deal_categories.xml", Method.POST)
            {
                XmlSerializer = new XmlIgnoreSerializer()
            };

            request.AddBody(category);

            var response = _client.Execute <DealCategory>(request);

            return(response.Data);
        }
        // GET: DealCategories/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DealCategory dealCategory = db.DealCategories.Find(id);

            if (dealCategory == null)
            {
                return(HttpNotFound());
            }
            return(View(dealCategory));
        }
Example #11
0
        public bool DeleteDealCategory(DealCategory objDealCategory)
        {
            var ExistingDealCategory = _db.DealCategories.FirstOrDefault(u => u.Id == objDealCategory.Id);

            if (ExistingDealCategory != null)
            {
                _db.DealCategories.Remove(ExistingDealCategory);
                _db.SaveChanges();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Example #12
0
        public bool UpdateDealCategory(DealCategory objDealCategory)
        {
            var ExistingDealCategory = _db.DealCategories.FirstOrDefault(u => u.Id == objDealCategory.Id);

            if (ExistingDealCategory != null)
            {
                objDealCategory.UpdatedTS = DateTime.Now;
                objDealCategory.UpdatedBy = "usernamexxx";
                ExistingDealCategory.Name = objDealCategory.Name;
                _db.SaveChanges();
            }
            else
            {
                return(false);
            }
            return(true);
        }
Example #13
0
        public DealCategory GetDealCategory(int DealCategoryId)
        {
            DealCategory obj = new DealCategory();

            return(_db.DealCategories.FirstOrDefault(u => u.Id == DealCategoryId));
        }
Example #14
0
        private void SeedDealCategories()
        {
            int dealCategoriesCount = _unitOfWork.DealCategory.GetCount();

            if (dealCategoriesCount == 0)
            {
                var dCategories = new DealCategory[] {
                    new DealCategory
                    {
                        Name           = "Autos",
                        ShortName      = "Autos",
                        Status         = SD.StatusActive,
                        SortSeq        = 1,
                        FAIcon         = "fas fa-car",
                        PublicCategory = true,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Entertainment",
                        ShortName      = "Entertainment",
                        Status         = SD.StatusActive,
                        SortSeq        = 2,
                        FAIcon         = "fas fa-theater-masks",
                        PublicCategory = true,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Books & Magazines",
                        ShortName      = "Books",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-book-reader",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Children",
                        ShortName      = "Children",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-child",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Clothing & Accessories",
                        ShortName      = "Apparel",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-luggage-cart",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Computers & Accessories",
                        ShortName      = "Computers",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-laptop-code",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Education",
                        ShortName      = "Education",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-user-graduate",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Credit Cards",
                        ShortName      = "Finance",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-piggy-bank",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Flowers & Gifts",
                        ShortName      = "Flowers",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-gift",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Freebies",
                        ShortName      = "Freebies",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-hand-holding-usd",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Grocery",
                        ShortName      = "Grocery",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-shopping-cart",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },

                    new DealCategory
                    {
                        Name           = "Health & Beauty",
                        ShortName      = "Health",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-medkit",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Home & Home Improvement",
                        ShortName      = "Home",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-home",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Jewerly & Watches",
                        ShortName      = "Jewerly",
                        SortSeq        = 2,
                        FAIcon         = "far fa-clock",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },

                    new DealCategory
                    {
                        Name           = "Office & School Supplies",
                        ShortName      = "Office",
                        SortSeq        = 2,
                        FAIcon         = "far fa-clipboard",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Pets",
                        ShortName      = "Pets",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-paw",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Phones & Accessories",
                        ShortName      = "Phones",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-phone",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Restaurants",
                        ShortName      = "Restaurants",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-wine-bottle",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Services",
                        ShortName      = "Services",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-shipping-fast",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Shoes",
                        ShortName      = "Shoes",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-shoe-prints",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Sports & Outdoors",
                        ShortName      = "Sports",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-football-ball",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Tech & Electronics",
                        ShortName      = "Electronics",
                        SortSeq        = 2,
                        FAIcon         = "fab fa-android",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Toys",
                        ShortName      = "Toys",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-dove",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Travel and Vacations",
                        ShortName      = "Travel",
                        SortSeq        = 2,
                        FAIcon         = "fas fa-umbrella-beach",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "Other",
                        ShortName      = "Other",
                        SortSeq        = 999,
                        FAIcon         = "fas fa-yin-yang",
                        PublicCategory = true,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                    new DealCategory
                    {
                        Name           = "General Store",
                        ShortName      = "General",
                        SortSeq        = 888,
                        FAIcon         = "fas fa-shopping-cart",
                        PublicCategory = false,
                        Status         = SD.StatusActive,
                        UpdatedTS      = DateTime.UtcNow,
                        UpdatedBy      = "System",
                        CreatedTS      = DateTime.UtcNow,
                        CreatedBy      = "System"
                    },
                };

                _unitOfWork.DealCategory.AddRange(dCategories);
                _unitOfWork.Save();
            }
        }