Example #1
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" }));
            }
        }
Example #2
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." }));
            }
        }