public ActionResult DeleteDepartment(int id)
        {
            var department = _departmentManager.GetById(id);

            department.IsActive = !department.IsActive;
            _departmentManager.Update(department);
            return(RedirectToAction("Index"));
        }
        // GET: Department/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var department = _iDepartmentManager.GetById(id);

            if (department == null)
            {
                return(NotFound());
            }
            return(View());
        }
예제 #3
0
        // GET: Departments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Department department = _departmentManager.GetById((int)id);

            if (department == null)
            {
                return(HttpNotFound());
            }
            DepartmentViewModel departmentViewModel = Mapper.Map <DepartmentViewModel>(department);

            return(View(departmentViewModel));
        }
예제 #4
0
        // GET: /Department/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Department department = _departmentManager.GetById((int)id);

            if (department == null)
            {
                return(HttpNotFound());
            }
            var organizationBranchList = _organizationBranchManager.GetAll();

            ViewBag.OrganizationBranchID = new SelectList(organizationBranchList, "OrganizationBranchID", "OrganizationBranchName");
            return(View(department));
        }
예제 #5
0
        // GET: Department/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var organaization = _organaizationManager.GetAll();

            Department department = _departmentManager.GetById((int)id);

            DepartmentViewModel departmentVM = new DepartmentViewModel()
            {
                Name          = department.Name,
                Organaization = organaization.Where(x => x.Id == department.OrganaizationId).FirstOrDefault()
            };

            return(View(departmentVM));
        }
예제 #6
0
        public async Task <IActionResult> GetDepartmentByIdAsync([FromRoute] string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return(BadRequest("Id is null or invalid"));
            }

            var department = await _departmentManager.GetById(id);

            if (department == null)
            {
                return(BadRequest("Department not found"));
            }

            var response = _mapper.Map <DepartmentResponse>(department);

            return(Ok(response));
        }
예제 #7
0
 public ActionResult Update(int id)
 {
     return(View(_departmentManager.GetById(id)));
 }
예제 #8
0
        public ActionResult Edit(int id)
        {
            Department aDepartment = _iDepartmentManager.GetById(id);

            return(View(aDepartment));
        }