Ejemplo n.º 1
0
        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 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);
     }
 }