Esempio n. 1
0
        public JsonResult Citizens()
        {
            KTNServiceClient client = new KTNServiceClient();

            PersonDto[] citizens = client.GetPersons();

            client.Close();
            return(Json(citizens, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult Persons()
        {
            KTNServiceClient client = new KTNServiceClient();
            IndexPersonsVM   model  = new IndexPersonsVM();

            model.Countries = client.GetRegions(RegionsType.COUNTRIES);
            model.Cities    = client.GetRegions(RegionsType.CITIES);
            model.Districts = client.GetRegions(RegionsType.DISTRICTS);

            client.Close();
            return(View(model));
        }
Esempio n. 3
0
        public ActionResult Login(LoginVM model)
        {
            if (ModelState.IsValid)
            {
                KTNServiceClient client = new KTNServiceClient();
                UserDto          user   = client.GetUser(model.UserName, model.Password);
                client.Close();
                if (user != null)
                {
                    Session["User"]   = user;
                    Session["IsAuth"] = true;
                    return(Redirect("/Home/Persons"));
                }
                else
                {
                    ModelState.AddModelError("", "Yalnış istifadəçi adı və ya şifrə");
                    return(View(model));
                }
            }

            return(View(model));
        }