Exemple #1
0
        public ActionResult Edit(ProductViewModel vmodel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(vmodel.Product).State = EntityState.Modified;
                //db.SaveChanges();
                IList <PRODUCT_TRANSLATION> productsT = TranslationBL.VerifyIsUniversal(vmodel.ProductsTrans, vmodel.IdProduct);
                foreach (var item in vmodel.ProductsTrans)
                {
                    db.Entry(item).State = EntityState.Modified;
                }
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            bool isUniversal = false;

            if (vmodel.ProductsTrans.Count() == 1)
            {
                isUniversal = true;
            }
            ViewBag.isUniversal = isUniversal;
            int lang  = LanguageBL.CheckLanguageSession();
            int ULang = LanguageBL.FindUniversalId();

            vmodel.ListLang        = LanguageBL.FindLanguageListWithoutUniversal();
            vmodel.CategoriesTrans = db.CATEGORY_TRANSLATIONs.Where(c => c.languageId == lang || c.languageId == ULang).ToList();
            vmodel.Ages            = db.AGEs.ToList();
            vmodel.Brands          = db.BRANDs.ToList();
            vmodel.HeroesTrans     = db.HERO_TRANSLATIONs.Where(c => c.languageId == lang || c.languageId == ULang).ToList();
            vmodel.Vats            = db.VATs.ToList();

            return(View(vmodel));
        }
Exemple #2
0
 public ActionResult Edit(HeroViewModel vmodel)
 {
     if (ModelState.IsValid)
     {
         bool isUniversal = TranslationBL.CheckIfUniversal(vmodel.HeroesTrans);
         db.Entry(vmodel.Hero).State = EntityState.Modified;
         foreach (var item in vmodel.HeroesTrans)
         {
             if (item.nameHero != null)
             {
                 if (isUniversal)
                 {
                     item.languageId      = LanguageBL.FindIdLanguageByShortForm("all");
                     db.Entry(item).State = EntityState.Modified;
                 }
                 else
                 {
                     db.Entry(item).State = EntityState.Modified;
                 }
             }
         }
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vmodel));
 }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "dateDay,terminalId,beginningCash,endCash")] CASH_BOTTOM_DAY cashD)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cashD).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.terminalId = new SelectList(db.TERMINALs, "idTerminal", "nameTerminal", cashD.terminalId);
     return(View(cashD));
 }
Exemple #4
0
 public ActionResult Edit(ShopViewModel vmodel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vmodel.Shop).State = EntityState.Modified;
         IList <SHOP_TRANSLATION> shopsT = TranslationBL.VerifyIsUniversal(vmodel.ShopsTrans, vmodel.Shop.idShop);
         foreach (var item in shopsT)
         {
             db.Entry(item).State = EntityState.Modified;
         }
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     vmodel.ListLang = LanguageBL.FindLanguageListWithoutUniversal();
     return(View(vmodel));
 }
Exemple #5
0
 public ActionResult Edit(CategoryViewModel vmodel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vmodel.Cat).State = EntityState.Modified;
         IList <CATEGORY_TRANSLATION> catsT = TranslationBL.VerifyIsUniversal(vmodel.CategoriesTrans, vmodel.Cat.idCategory);
         foreach (var item in catsT)
         {
             db.Entry(item).State = EntityState.Modified;
         }
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     vmodel.ListLang = LanguageBL.FindLanguageListWithoutUniversal();
     return(View(vmodel));
 }
Exemple #6
0
 public ActionResult Edit([Bind(Include = "idLanguage,nameLanguage,shortForm")] LANGUAGES lANGUAGES)
 {
     if (ModelState.IsValid)
     {
         db.Entry(lANGUAGES).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(lANGUAGES));
 }
Exemple #7
0
 public ActionResult Edit([Bind(Include = "idRole,nameRole")] AspNetRoles role)
 {
     if (ModelState.IsValid)
     {
         db.Entry(role).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(role));
 }
Exemple #8
0
 public ActionResult Edit([Bind(Include = "idBrand,nameBrand,imageBrand")] BRAND bRAND)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bRAND).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(bRAND));
 }
Exemple #9
0
 public ActionResult Edit([Bind(Include = "idVat,appliedVat")] VAT vAT)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vAT).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vAT));
 }
Exemple #10
0
 public ActionResult Edit([Bind(Include = "idAge,imageAge,rangeAges")] AGE aGE)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aGE).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aGE));
 }
 public ActionResult Edit([Bind(Include = "idPaymentMethod,method")] PAYMENT_METHOD pAYMENT_METHOD)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pAYMENT_METHOD).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(pAYMENT_METHOD));
 }
Exemple #12
0
        public ActionResult Edit([Bind(Include = "idTerminal,nameTerminal,shopId")] TERMINAL terminal)
        {
            if (ModelState.IsValid)
            {
                db.Entry(terminal).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            int lang      = LanguageBL.CheckLanguageSession();
            int universal = db.LANGUAGESs.Where(l => l.shortForm == "all").Select(s => s.idLanguage).Single();

            ViewBag.shopId = new SelectList(db.SHOP_TRANSLATIONs.Include(t => t.SHOP).Where(s => s.languageId == lang || s.languageId == universal), "shopId", "nameShop", terminal.shopId);
            return(View(terminal));
        }
Exemple #13
0
 public ActionResult Edit(MessageViewModel vmodel)
 {
     if (ModelState.IsValid)
     {
         IList <MESSAGE_TRANSLATION> messagesT = TranslationBL.VerifyIsUniversal(vmodel.MessagesTrans, vmodel.IdMessage);
         foreach (var item in messagesT)
         {
             db.Entry(item).State = EntityState.Modified;
         }
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     vmodel.ListLang = LanguageBL.FindLanguageListWithoutUniversal();
     return(View(vmodel));
 }
Exemple #14
0
        public ActionResult DeleteConfirmed(TRANSACTIONS tr, int id)
        {
            TRANSACTIONS transaction = db.TRANSACTIONSs.Find(id);

            if (tr.cancelDescritpion != null)
            {
                transaction.cancelDescritpion = tr.cancelDescritpion;
                transaction.statusId          = db.STATUSs.Where(s => s.nameStatus == "deleted").Select(st => st.idStatus).Single();
                db.Entry(transaction).State   = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.noReason = "Un motif est obligatoire";
            return(View(transaction));
        }
Exemple #15
0
        public ActionResult Edit([Bind(Include = "idSetting,nameSetting,valueSetting")] SETTING setting)
        {
            if (ModelState.IsValid)
            {
                //check value setting
                bool edit = false;
                switch (setting.nameSetting)
                {
                case "Vat":
                    if (decimal.Parse(setting.valueSetting) > 0 && decimal.Parse(setting.valueSetting) <= 1)
                    {
                        edit = true;
                    }
                    else
                    {
                        ViewBag.Error = "la valeur doit être comprise entre 0 et 1 => exemple: 0.21";
                    }
                    break;

                case "Language":
                    var test = db.LANGUAGESs.Select(l => l.shortForm).ToList();
                    if (test.Contains(setting.valueSetting))
                    {
                        edit = true;
                    }
                    else
                    {
                        ViewBag.Error = "La valeur n'est pas correcte. Référez-vous au abréviation des langages dans le Menu Gestion -->  Langages";
                    }
                    break;

                default:
                    ViewBag.Error = "La valeur n'est pas correcte.  Si le problème persiste, contactez l'administrateur";
                    break;
                }
                if (edit)
                {
                    db.Entry(setting).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }
            return(View(setting));
        }
Exemple #16
0
 public void UpdateUserInfo(USERINFO userInfo, string nameRole)
 {
     db.Entry(userInfo).State = EntityState.Modified;
     db.SPP_AspNetUserRoles_Update(userInfo.userId, nameRole);
     db.SaveChanges();
 }