Esempio n. 1
0
        public ActionResult newDepartment(Department department)
        {
            if (ModelState.IsValid)
            {
                var com           = _companyService.GetCompanyByID(department.ComapanyID);
                var newDepartment = _departmentService.InsertDepartment(department.Name, department.Description, com.Id);

                if (newDepartment != null)
                {
                    return(RedirectToAction("SuccessDepartment"));
                }
            }
            else
            {
                ModelState.AddModelError("", "Invalid data");
            }
            return(View("newDepartment"));
        }