public JsonResult Citizens() { KTNServiceClient client = new KTNServiceClient(); PersonDto[] citizens = client.GetPersons(); client.Close(); return(Json(citizens, JsonRequestBehavior.AllowGet)); }
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)); }
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)); }