private Object ToJSON(vm.SemesterViewModel semester) { return(JsonConvert.SerializeObject(semester, Formatting.Indented, new JsonSerializerSettings() { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })); }
public JsonResult Create(vm.SemesterViewModel semester) { Message msg = null; if (!ModelState.IsValid) { msg = new Message() { Code = 0, Messages = "Error, debe completar los campos", Class = "label label-danger" }; return(Json(msg, JsonRequestBehavior.AllowGet)); } if (_semesterService.ExitSemesterCode(semester.SemesterCode)) { msg = new Message() { Code = 1, Messages = "Código Académico ya exite", Class = "label label-warning" }; return(Json(msg, JsonRequestBehavior.AllowGet)); } semester.Status = Helpers.Status.Active; semester.Created = DateTime.Now; _semesterService.Add(semester.GenericConvert <domain.Semester>()); msg = new Message() { Code = 1, Messages = "Registro completado satisfactoriamente", Class = "label label-success" }; return(Json(msg, JsonRequestBehavior.AllowGet)); }