Exemple #1
0
        public JsonResult Action(ClassActionModel model)
        {
            var        result = false;
            JsonResult json   = new JsonResult();

            if (model.ID > 0) // We try to edit record
            {
                var course = ClassService.Instance.GetClassesById(model.ID);
                course.Name        = model.Name;
                course.Description = model.Description;
                result             = ClassService.Instance.UpdateClasses(course);
            }
            else // We try to create record
            {
                Class course = new Class();
                course.Name        = model.Name;
                course.Description = model.Description;

                result = ClassService.Instance.SaveClasses(course);
            }


            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to Perform action on Classes" };
            }
            return(json);
        }
        public ActionResult Delete(int?ID = 0)
        {
            ClassActionModel model = new ClassActionModel();

            model.ClassID = ID.Value;
            return(PartialView("_Delete", model));
        }
        public ActionResult Delete(ClassActionModel model)

        {
            var data = services.getClassbyID(model.ClassID);

            services.deleteClass(data);
            return(RedirectToAction("Index"));
        }
Exemple #4
0
        public ActionResult Delete(int ID)
        {
            ClassActionModel model = new ClassActionModel();
            var course             = ClassService.Instance.GetClassesById(ID);

            model.ID = course.ID;
            return(PartialView("_Delete", model));
        }
        public ActionResult Action(int?id)
        {
            ClassActionModel model = new ClassActionModel();

            if (id.HasValue)
            {
                var getData = services.getClassbyID(id.Value);
                model.ClassID = getData.ID;
                model.Name    = getData.ClassName;
            }
            //Show Modal

            return(PartialView("_Action", model));
        }
        public ActionResult Action(ClassActionModel model)
        {
            var   getData = services.getClassbyID(model.ClassID);
            Class cla     = new Class();

            //Save Data from Modal To Database
            if (model.ClassID > 0)
            {
                getData.ClassName = model.Name;
                services.eidtClass(getData);
            }
            else
            {
                cla.ClassName = model.Name;
                services.saveClass(cla);
            }
            return(RedirectToAction("Index"));
        }
Exemple #7
0
        public ActionResult Action(int?ID)
        {
            ClassActionModel model = new ClassActionModel();

            if (ID.HasValue)//we are trying to edit record
            {
                var course = ClassService.Instance.GetClassesById(ID.Value);
                model.ID          = course.ID;
                model.Name        = course.Name;
                model.Description = course.Description;
            }
            //else no need
            //{

            //}

            return(PartialView("_Action", model));
        }
Exemple #8
0
        public JsonResult Delete(ClassActionModel model)
        {
            var        result = false;
            JsonResult json   = new JsonResult();

            var course = ClassService.Instance.GetClassesById(model.ID);

            result = ClassService.Instance.Deleteclasses(course);


            if (result)
            {
                json.Data = new { Success = true };
            }
            else
            {
                json.Data = new { Success = false, Message = "Unable to Perform action on Classes." };
            }
            return(json);
        }