예제 #1
0
        public async Task <JsonResult> AjaxRequest(NameType?nameType, NameGender?nameGender, int limit)
        {
            if (nameType == null && nameGender == null)
            {
                nameList = await NameService.GetNameList(limit);

                return(Json(nameList));
            }
            else if (nameType == null && nameGender != null)
            {
                nameList = await NameService.GetNameList(nameGender, limit);

                return(Json(nameList));
            }
            else if (nameGender == null && nameType != null)
            {
                nameList = await NameService.GetNameList(nameType, limit);

                return(Json(nameList));
            }
            else
            {
                nameList = await NameService.GetNameList(nameType, nameGender, limit);

                return(Json(nameList));
            }
        }
예제 #2
0
        public async Task <ActionResult> UpdateRequest(NameType?nameType, NameGender?nameGender, int limit)
        {
            if (nameType == null && nameGender == null)
            {
                nameList = await NameService.GetNameList(limit);

                return(View("Index", nameList));
            }
            else if (nameType == null && nameGender != null)
            {
                nameList = await NameService.GetNameList(nameGender, limit);

                return(View("Index", nameList));
            }
            else if (nameGender == null && nameType != null)
            {
                nameList = await NameService.GetNameList(nameType, limit);

                return(View("Index", nameList));
            }
            else
            {
                nameList = await NameService.GetNameList(nameType, nameGender, limit);

                return(View("Index", nameList));
            }
        }
예제 #3
0
        public async Task <ActionResult> Index()
        {
            //Default request när sidan laddas
            nameList = await NameService.GetNameList(10);

            return(View(nameList));
        }
예제 #4
0
        public ActionResult Index()
        {
            // starting limit of 10 names with NameType=Both and NameGender=Both
            int limit = 10;

            // Getting the list from the NameAPI library
            nameList = NameService.GetNameList(limit);
            return(View(nameList));
        }
예제 #5
0
        public ActionResult Reload(NameGender gender, NameType type, int limit)
        {
            // storing the choises in the predefined variables
            ctrlGender = gender;
            ctrlType   = type;
            ctrlLimit  = limit;

            // Getting the list from the NameAPI library
            nameList = NameService.GetNameList(type, gender, limit);
            return(View("Index", nameList));
        }
예제 #6
0
 public ActionResult AjaxReload()
 {
     nameList = NameService.GetNameList(ctrlType, ctrlGender, ctrlLimit);
     return(PartialView("_AjaxView", nameList));
 }