Example #1
0
        public IActionResult Create()
        {
            var vmo = new ApartadoVMO();

            vmo.StateView = Models.Enum.StateViewEnum.Nuevo;

            return(PartialView("_ModalApartado", vmo));
        }
Example #2
0
        public IActionResult Create(ApartadoVMO vmo)
        {
            try
            {
                var model = ApartadoAdapterVMO.ConvertToModel(vmo);
                _serviceApartado.AddElement(model);

                return(Json(new { success = true, message = "Se ha creado correctamente" }));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public IActionResult Edit(ApartadoVMO vmo)
        {
            try
            {
                var model = _serviceApartado.GetElementById(vmo.Id);
                model = ApartadoAdapterVMO.ConvertToModel(vmo, model);
                _serviceApartado.UpdateElement(model);

                return(Json(new { success = true, message = "Se ha editado correctamente" }));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
        public static Data.Context.Apartado ConvertToModel(ApartadoVMO vmo, Data.Context.Apartado model)
        {
            model = HelperAdapter <ApartadoVMO, Data.Context.Apartado> .ConvertToModel(vmo, model);

            return(model);
        }