public ActionResult SearchCriminals(FormCollection collection) { string errorMessage = "Something wrong, verify the inputs. Remeber, the age is from 16 to 100"; string okMessage = "Ok, you will receive an email with the informations"; try { bool result = false; string searchTerm = collection["Search"]; string name = collection["Name"]; int? ageStart = null; int? ageEnd = null; int? idCountry = null; int? idSexType = null; if (collection["AgeStart"] != string.Empty) { ageStart = Convert.ToInt32(collection["AgeStart"]); } if (collection["AgeEnd"] != string.Empty) { ageEnd = Convert.ToInt32(collection["AgeEnd"]); } if (collection["Country"] != string.Empty) { idCountry = Convert.ToInt32(collection["Country"]); } if (collection["SexType"] != string.Empty) { idSexType = Convert.ToInt32(collection["SexType"]); } string x = collection["WWWSADASD"]; var user = UserManager.FindById(User.Identity.GetUserId()); CriminalServiceReference.ServiceCriminalClient serviceCriminal = new CriminalServiceReference.ServiceCriminalClient(); //result = serviceCriminal.SearchCriminalList(user.Email, searchTerm, name, ageStart, ageEnd, idSexType, idCountry); result = new CriminalApplication().serviceCriminal.ExecuteSearch(user.Email, searchTerm, name, ageStart, ageEnd, idSexType, idCountry); // TODO: Add update logic here if (result) { return(Json(okMessage)); } else { return(Json(errorMessage)); } } catch { return(Json(errorMessage)); } }
public ActionResult Index() { CriminalApplication criminalApplication = new CriminalApplication(); ViewBag.DropdownCountry = new SelectList ( criminalApplication.repositoryCountry.ListAll(), "Id", "Description" ); ViewBag.DropdownSex = new SelectList ( criminalApplication.repositorySexType.ListAll(), "Id", "Description" ); return(View()); }
public bool SearchCriminalList(string email, string searchTerm, string name, int?ageStart, int?ageEnd, int?idSex, int?idCountry) { CriminalApplication criminalApplication = new CriminalApplication(); return(criminalApplication.serviceCriminal.ExecuteSearch(email, searchTerm, name, ageStart, ageEnd, idSex, idCountry)); }