public IActionResult Create() { var vmo = new SesionVMO(); vmo.StateView = Models.Enum.StateViewEnum.Nuevo; vmo.Apartados = _serviceApartado.GetElements().Select(x => new SelectListItem() { Text = x.Nombre, Value = x.Id.ToString() }); return(PartialView("_ModalSesion", vmo)); }
public IActionResult Create(SesionVMO vmo) { try { var model = SesionAdapter.ConvertToModel(vmo); _serviceSesion.AddElement(model); return(Json(new { success = true, message = "Se ha creado correctamente" })); } catch (Exception ex) { return(Json(new { success = false, message = "Ha ocurrido un error" })); } }
public IActionResult Edit(SesionVMO vmo) { try { var model = _serviceSesion.GetElementById(vmo.Id); model = SesionAdapter.ConvertToModel(vmo, model); _serviceSesion.UpdateElement(model); return(Json(new { success = true, message = "Se ha editado correctamente" })); } catch (Exception ex) { return(Json(new { success = true, message = "Ha ocurrido un error." })); } }
public static Data.Context.Sesion ConvertToModel(SesionVMO vmo, Data.Context.Sesion model) { model = HelperAdapter <SesionVMO, Data.Context.Sesion> .ConvertToModel(vmo, model); return(model); }