예제 #1
0
        public ActionResult Add(int?id)
        {
            DeparmentService service    = new DeparmentService();
            Department       department = service.FindByKey(id);

            return(View(department));
        }
예제 #2
0
        public ActionResult Add(int?Id
                                , string DepartmentName
                                , string Description
                                , bool Status
                                )
        {
            DeparmentService deparmentService = new DeparmentService();
            Department       department       = deparmentService.FindByKey(Id);

            department.DepartmentName = DepartmentName;
            department.Description    = Description;
            department.Status         = Status;
            if (Id.HasValue)
            {
                deparmentService.Update(department);
                setAlert("Sửa khoa thành công", "success");
            }
            else
            {
                deparmentService.Insert(department);
                setAlert("Thêm khoa thành công", "success");
            }
            return(RedirectToAction("Index"));
        }