public bool AddEmployee(Employee data, ref string message) { ObjectParameter messageParameter = new ObjectParameter("message", typeof(string)); ObjectParameter resultParameter = new ObjectParameter("salida", typeof(bool)); context.sp_RegisterEmployee( 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.Antique, data.Salary, messageParameter, resultParameter ); message = messageParameter.Value.ToString(); return Convert.ToBoolean(resultParameter.Value); }
public ActionResult Employee(Employee 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.AddEmployee(data, ref message); if (IsSuccess) { return Content("<div id=formEmployee><script>redirectToHome();</script></div>"); } else { ViewBag.ErrorProcedure = message; return PartialView("_Employee", data); } } else { return PartialView("_Employee", data); } }