public override bool Equals(object o) { AdminCountry other = o as AdminCountry; if (other == null) { return(false); } return(CtCode.Equals(other.CtCode)); }
// GET: Admin public ActionResult Index() { if (Session["Admin"] == null) { return(RedirectToAction("Login")); } IndexAdminViewModel model = new IndexAdminViewModel(); model.Pending = new Dictionary <string, List <BuildUnsignedVCResponse> >(); if (AdminCountry.ContainsKey(Admin)) { foreach (var cred in UnsignedCredentials) { foreach (var valueCred in cred.Value) { if (valueCred.unsignedCredential.credentialSubject.data.Country == AdminCountry[Admin]) { if (model.Pending.ContainsKey(cred.Key)) { model.Pending[cred.Key].Add(valueCred); } else { model.Pending.Add(cred.Key, new List <BuildUnsignedVCResponse>() { valueCred }); } } } } } else { model.Pending = UnsignedCredentials; } return(View(model)); }
public ActionResult SignUp(AdminSignUp Form) { AdminSignupViewModel model = new AdminSignupViewModel(); model.Form = Form; if (!ModelState.IsValid) { return(View(model)); } var json = JsonConvert.SerializeObject(new { username = Form.username, password = Form.password }); var data = new StringContent(json, Encoding.UTF8, "application/json"); var url = URLAffinidy + "/users/signup"; using (var client = new HttpClient()) { client.DefaultRequestHeaders.Add("Api-Key", HashAffinidy); var response = client.PostAsync(url, data).Result; string result = response.Content.ReadAsStringAsync().Result; var respuesta = JsonConvert.DeserializeObject <ResponseSignUp>(result); if (respuesta.accessToken != null) { UserDids.Add(Form.username, respuesta.did); AdminCountry.Add(Form.username, Form.country); ViewBag.Message = "Successful signup."; return(RedirectToAction("Login")); } else { ViewBag.Error = respuesta.message; return(View(model)); } } }