示例#1
0
        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));
        }
示例#2
0
        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" }));
            }
        }
示例#3
0
        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." }));
            }
        }
示例#4
0
        public static Data.Context.Sesion ConvertToModel(SesionVMO vmo, Data.Context.Sesion model)
        {
            model = HelperAdapter <SesionVMO, Data.Context.Sesion> .ConvertToModel(vmo, model);

            return(model);
        }