public void CheckIfFunctionReturnsControllersName() { HomeController home = new HomeController(); var result = UtiOther.GetControllerName(home.ControllerContext); Assert.Equal("Home", result); }
// GET: WorkStation/Delete/5 public ActionResult Delete(long id) { ViewBag.ControllerName = UtiOther.GetControllerName(this.ControllerContext); var dataObj = _service.find(s => s.Id == id); return(View("_delete", dataObj)); }
// GET: WorkStation/Resource/5 public ActionResult Resource(long id) { ViewBag.ControllerName = UtiOther.GetControllerName(this.ControllerContext); ViewBag.DepartmentName = id > 0 ? _service.Get(s => s.Id == id).SingleOrDefault().Name.ToString():null; var dataObj = id > 0 ? _personService.Get(s => s.Departments.Id == id) :null; return(View("_view", dataObj)); }
public ActionResult Index(string searchString) { ViewBag.ControllerName = UtiOther.GetControllerName(this.ControllerContext); var datacollection = !string.IsNullOrEmpty(searchString) ? _service.Get(s => s.Name.ToUpper().Contains(searchString.ToUpper())).OrderBy(s => s.Name) : _service.Get().OrderBy(s => s.Name); return(View("_list", datacollection)); }
// GET: WorkStation/Create public ActionResult Add() { ViewBag.ControllerName = UtiOther.GetControllerName(this.ControllerContext); var personObj = new PersonWriteViewModels(); #region gender personObj.AvailableGender.Add(new SelectListItem { Text = "Select Sex", Value = "" }); personObj.AvailableGender.Add(new SelectListItem { Text = "Female", Value = "Female" }); personObj.AvailableGender.Add(new SelectListItem { Text = "Male", Value = "Male" }); #endregion #region departments var departments = _departmentService.Get(); foreach (var item in departments) { personObj.AvailableDepartment.Add(new SelectListItem { Text = item.Name, Value = item.Id.ToString() }); } #endregion return(View("_add", personObj)); }
public ActionResult Index(string sortOrder, string searchString) { ViewBag.ControllerName = UtiOther.GetControllerName(this.ControllerContext); var department = new List <DepartmentViewModel>(); ViewData["NameSortParm"] = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; ViewData["DateSortParm"] = sortOrder == "Date" ? "date_desc" : "Date"; var data = !string.IsNullOrEmpty(searchString) ? _service.Get(s => s.Name.ToLower() .Contains(searchString.ToLower())) : _service.Get(); foreach (var item in data) { department.Add(new DepartmentViewModel { Id = item.Id, Name = item.Name, ResourceCount = item.People.LongCount() }); } return(View("_list", department)); }
// GET: WorkStation/Edit/5 public IActionResult Edit(long id) { ViewBag.ControllerName = UtiOther.GetControllerName(this.ControllerContext); var personObj = _service.find(s => s.Id == id); #region gender personObj.AvailableGender.Add(new SelectListItem { Text = "Select Sex", Value = "" }); personObj.AvailableGender.Add(new SelectListItem { Text = "Female", Value = "Female" }); personObj.AvailableGender.Add(new SelectListItem { Text = "Male", Value = "Male" }); #endregion #region departments var departments = _departmentService.Get(); foreach (var item in departments) { personObj.AvailableDepartment.Add(new SelectListItem { Text = item.Name, Value = item.Id.ToString() }); } #endregion return(View("_edit", personObj)); }
public string ControllerName() { return(UtiOther.GetControllerName(this.ControllerContext)); }
public IActionResult Index() { ViewBag.ControllerName = UtiOther.GetControllerName(this.ControllerContext); return(View()); }
// GET: WorkStation/Create public ActionResult Add() { ViewBag.ControllerName = UtiOther.GetControllerName(this.ControllerContext); return(View("_add")); }