public ActionResult GenerateNewId() { IDNumber idno = new IDNumber(); var uri = Server.MapPath("~/api/id"); var client = new HttpClient(); var task = client.GetAsync(uri); if (task.Result.IsSuccessStatusCode) { idno.IDnumber = task.Result.Content.ToString(); } return View(idno); }
public ActionResult ValidateId(string id) { var idno = new IDNumber(); idno.IDnumber = id; var uri = Server.MapPath("~/api/id"); var client = new HttpClient(); var task = client.GetAsync(uri + "/" + id); client.BaseAddress = new Uri(uri); client.DefaultRequestHeaders.Accept.Clear(); // New code: if (task.Result.IsSuccessStatusCode) { idno.result = "ID is valid"; } else { idno.result = "ID is NOT valid";} return View(idno); }
public ActionResult Index() { var id = new IDNumber(); return View(id); }