public async Task <IActionResult> Register([FromBody] RegisterPsychologistCommand command) { return(Ok(await Mediator.Send(command))); }
protected void aceptar_Click(object sender, EventArgs e) { String pwd = Request.Form["password"]; pwd = GenerateSHA256String(pwd); String re_password = Request.Form["re_password"]; re_password = GenerateSHA256String(re_password); String id = Request.Form["idNumber"]; String psychologicalId = Request.Form["psychologicalId"]; String firstname = Request.Form["firstname"]; String secondname = Request.Form["secondname"]; String firstlastname = Request.Form["firstlastname"]; String secondlastname = Request.Form["secondlastname"]; String birthday = Request.Form["birthday"]; String email = Request.Form["email"]; if (!pwd.Equals("") && !re_password.Equals("") && !id.Equals("") && !psychologicalId.Equals("") && !firstname.Equals("") && !firstlastname.Equals("") && !birthday.Equals("") && !email.Equals("")) { int _id = Convert.ToInt32(id); DateTime birthdate = DateTime.Parse(birthday); _psychologist = new Psychologist(_id, email, pwd, firstname, secondname, firstlastname, secondlastname, psychologicalId, birthdate); if (pwd.Equals(re_password)) { RegisterPsychologistCommand cmd = new RegisterPsychologistCommand(_psychologist); try { cmd.execute(); _psychologistRegistered = cmd.getAnswer(); if (_psychologistRegistered._Error == Registry.RESULTADO_CODIGO_RECURSO_CREADO) { Response.Redirect("../Home/index.aspx"); //Session["USER_ID"] = _psychologistRegistered._ID; //string script = "alert(\"Se ha completado el registro exitosamente\");"; //ScriptManager.RegisterStartupScript(this, GetType(), // "ServerControlScript", script, true); //Response.AddHeader("REFRESH", "1;URL=/View/Home/postlogin.aspx"); } else { string script = "BootAlert('No se ha podido completar el registro, por favor intente nuevamente');"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); //string script = "alert(\"No se ha podido completar el registro, por favor intente nuevamente\");"; //ScriptManager.RegisterStartupScript(this, GetType(), // "ServerControlScript", script, true); } } catch (Exception ex) { string script = "BootAlert('No se ha podido completar el registro, por favor intente nuevamente');"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); //string script = "alert(\"No se ha podido completar el registro, por favor intente nuevamente\");"; //ScriptManager.RegisterStartupScript(this, GetType(), // "ServerControlScript", script, true); } } else { string script = "BootAlert('Existen campos vacíos en el formulario');"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); //string script = "alert(\"Existen campos vacíos en el formulario\");"; //ScriptManager.RegisterStartupScript(this, GetType(), // "ServerControlScript", script, true); } } else { string script = "BootAlert('Existen campos vacíos en el formulario');"; ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); //string script = "alert(\"Existen campos vacíos en el formulario\");"; //ScriptManager.RegisterStartupScript(this, GetType(), // "ServerControlScript", script, true); } }