public bool AddStudent(Student data, ref string message) { ObjectParameter messageParameter = new ObjectParameter("message", typeof(string)); ObjectParameter resultParameter = new ObjectParameter("salida", typeof(bool)); context.sp_RegisterStudent(data.Person.Name, data.Person.LastName, data.Person.DNI, data.Person.BirthDate, data.Person.Phone, data.Person.Email, this.EncryptSHA256(data.Person.Email), data.Person.Password, data.IdCareer, data.IdCondition, messageParameter, resultParameter); message = messageParameter.Value.ToString(); return Convert.ToBoolean(resultParameter.Value); }
public ActionResult Student(Student data, int idDays, int idMonths, int idYears) { if (ModelState.IsValid) { string message = ""; DateTime birth = new DateTime(idYears, idMonths, idDays); birth.ToString("dd-mm-yyyy", CultureInfo.InvariantCulture); data.Person.BirthDate = birth; bool IsSuccess = userService.AddStudent(data, ref message); if (IsSuccess) { return Content("<div id=formStudent><script>redirectToHome();</script></div>"); } else { ViewBag.ErrorProcedure = message; return PartialView("_Student", data); } } else { return PartialView("_Student", data); } }