public bool Update(MathStudent mode)
        {
            try
            {
                var bd = db.MathStudents.Find(mode.MathsID);

                // bd.MathStudentID = mode.MathStudentID;
                //bd.CreateBy = mode.CreateBy;
                //bd.CreateDate = mode.CreateDate;
                bd.Description  = mode.Description;
                bd.DisplayOrder = mode.DisplayOrder;
                bd.Image        = mode.Image;
                bd.GroupMathsID = mode.GroupMathsID;
                bd.LanguageID   = mode.LanguageID;

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

                bd.Name = mode.Name;

                bd.Sources = mode.Sources;
                bd.Status  = mode.Status;

                db.SaveChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Example #2
0
        public ActionResult Edit(MathStudent collection)
        {
            MathStudentDao bdDao = new MathStudentDao();

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

                collection.ModifiedBy   = us.UserName;
                collection.ModifiedDate = Hepper.GetDateServer();
                // ConvertExcelToXml convertXML = new ConvertExcelToXml();
                //string xml = convertXML.GetXML(collection.Sources);
                //  int i = 0;
                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());
            }
        }
Example #3
0
        public ActionResult Create(MathStudent collection)
        {
            GroupMathDropDownList(collection.GroupMathsID);
            try
            {
                MathStudentDao bdDao = new MathStudentDao();

                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());
            }
        }
Example #4
0
        // GET: Admin/MathStudent/Edit/5
        public ActionResult Edit(long id)
        {
            MathStudentDao db          = new MathStudentDao();
            MathStudent    mathStudent = db.FindByID(id);

            GroupMathDropDownList(mathStudent.GroupMathsID);
            return(View(mathStudent));
        }
        public bool Insert(MathStudent mode)
        {
            try
            {
                db.MathStudents.Add(mode);
                db.SaveChanges();
                return(true);
            }

            catch
            {
                return(false);
            }
        }