예제 #1
0
        public ActionResult Add(int?Id,
                                string ClassName,
                                string ListDepartmentId,
                                string Description,
                                bool Status)
        {
            ClassRoomService classroomservice = new ClassRoomService();
            ClassRoom        classroom        = classroomservice.FindByKey(Id);

            classroom.ClassName = ClassName;
            if (!string.IsNullOrEmpty(ListDepartmentId))
            {
                classroom.DepartmentID = Convert.ToInt32(ListDepartmentId);
            }
            classroom.Description = Description;
            classroom.Status      = Status;
            classroom.IsDelete    = false;
            if (Id.HasValue)
            {
                classroomservice.Update(classroom);
                TempData["StatusMessage"] = "Cập Nhật Lớp Học Thành Công";
            }
            else
            {
                classroomservice.Insert(classroom);
                TempData["StatusMessage"] = "Thêm Mới Lớp Học Thành Công";
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Add(int?Id
                                , string ClassName
                                , string Description
                                , string ListDepartmentID
                                , bool Status
                                )
        {
            ClassRoomService classRoomService = new ClassRoomService();
            ClassRoom        classRoom        = classRoomService.FindByKey(Id);

            classRoom.ClassName   = ClassName;
            classRoom.Description = Description;
            if (!string.IsNullOrEmpty(ListDepartmentID))
            {
                classRoom.DepartmentID = Convert.ToInt32(ListDepartmentID);
            }

            classRoom.Description = Description;
            classRoom.Status      = Status;
            classRoom.IsDelete    = false;
            if (Id.HasValue)
            {
                classRoomService.Update(classRoom);
                setAlert("Sửa lớp thành công", "success");
            }
            else
            {
                classRoomService.Insert(classRoom);
                setAlert("Thêm lớp thành công", "success");
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Update(ClassRoomEditViewModel ClassRoom)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            ClassRoomService.Update(ClassRoom);
            return(RedirectToAction("ClassRoom"));
        }