Exemple #1
0
        public ActionResult Create(GroupMath collection)
        {
            try
            {
                GroupMathDao bdDao = new GroupMathDao();

                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];
                collection.CreateBy     = us.UserName;
                collection.CreateDate   = Hepper.GetDateServer();
                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();
                collection.LanguageID   = "vi";
                //collection.CreateBy = us.UserName;
                //collection.ModifiedBy = us.UserName;
                if (bdDao.Insert(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordSuccess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminCreateRecordFailed, "danger");
                return(View());
            }
        }
Exemple #2
0
        public ActionResult Edit(GroupMath collection)
        {
            GroupMathDao bdDao = new GroupMathDao();

            try
            {
                UserLogin us = (UserLogin)Session[SystemConsts.USER_SESSION];

                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();


                if (bdDao.Update(collection))
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordSucess, "success");
                    return(RedirectToAction("Index"));
                }
                else
                {
                    SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                SetAlert(@Resources.ResourceAdmin.AdminEditRecordFailed, "danger");
                return(View());
            }
        }
Exemple #3
0
        public bool Update(GroupMath mode)
        {
            try
            {
                var bd = db.GroupMaths.Find(mode.GroupMathsID);
                if (string.IsNullOrEmpty(mode.MetaTite))
                {
                    bd.MetaTite = HepperString.ToUnsignString(mode.Name);
                }
                else
                {
                    bd.MetaTite = mode.MetaTite;
                }
                if (string.IsNullOrEmpty(mode.SeoTite))
                {
                    bd.SeoTite = mode.Name;
                }
                else
                {
                    bd.SeoTite = mode.SeoTite;
                }
                // bd.GroupMathID = mode.GroupMathID;
                //bd.CreateBy = mode.CreateBy;
                //bd.CreateDate = mode.CreateDate;
                bd.Description  = mode.Description;
                bd.DisplayOrder = mode.DisplayOrder;


                // bd.LanguageID = mode.LanguageID;
                bd.MetaDescription = mode.MetaDescription;
                bd.MetakeyWords    = mode.MetakeyWords;

                bd.ModifiedBy   = mode.ModifiedBy;
                bd.ModifiedDate = mode.ModifiedDate;


                bd.ShowOnHome = mode.ShowOnHome;
                bd.Status     = mode.Status;
                bd.Name       = mode.Name;


                db.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #4
0
        // GET: Admin/GroupMath/Details/5
        public ActionResult Details(long id)
        {
            GroupMathDao dbDAO = new GroupMathDao();
            GroupMath    cat   = null;

            try
            {
                cat = dbDAO.FindByID(id);
            }
            catch
            {
                ModelState.AddModelError("", Resources.ResourceAdmin.ErrorGetRecordMessage);
            }
            return(View(cat));
        }
Exemple #5
0
        public ActionResult Edit(long id)
        {
            GroupMathDao dbDAO = new GroupMathDao();
            GroupMath    cat   = null;

            try
            {
                cat = dbDAO.FindByID(id);

                // ViewBag.GroupID = new SelectList(dbContext..ToList(), "ID", "Name");
            }
            catch
            {
                ModelState.AddModelError("", Resources.ResourceAdmin.ErrorGetRecordMessage);
            }
            return(View(cat));
        }
Exemple #6
0
        public bool Insert(GroupMath mode)
        {
            try
            {
                if (string.IsNullOrEmpty(mode.MetaTite))
                {
                    mode.MetaTite = HepperString.ToUnsignString(mode.Name);
                }
                if (string.IsNullOrEmpty(mode.SeoTite))
                {
                    mode.SeoTite = mode.Name;
                }
                db.GroupMaths.Add(mode);
                db.SaveChanges();
                return(true);
            }

            catch
            {
                return(false);
            }
        }