using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using TelerikAspNetCoreApp135.Models;

namespace TelerikAspNetCoreApp135.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        public ActionResult SearchQuery(string text)
        {
            List<SampleModel> data = new List<SampleModel>();

            for (int i = 10; i < 20; i++)
            {
                data.Add(new SampleModel()
                {
                    Id = i,
                    Name = "Name" + i,
                    Dob = "Dob" + i,
                    SearchOptions = "Option" + i
                });
            }

            return Json(data);
        }

        [HttpPost]
        public ActionResult LinkToCase(int tagItem, string searchOptions)
        {
            if (!ModelState.IsValid)
            {
                return View("Success");
            }
            else {
                return View("Error");
            }
        }
    }
}
