public JsonResult DepartamentExists(long id, string name) { var departament = _departamentUtil.GetDepartamentByName(name); var result = departament == null || departament.DepartamentId == id; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(string departament) { var model = new HomeViewModel { SelectedDepartament = departament }; if (string.IsNullOrEmpty(departament)) { model.Pictures = _pictureUtil.GetPicturess().ToList(); } else { var dep = _departamentUtil.GetDepartamentByName(departament); model.Pictures = dep == null?_pictureUtil.GetPicturess().ToList() : dep.Picture.ToList(); } return(View(model)); }