Ejemplo n.º 1
0
        public ActionResult DeleteResource(string buttonYes, string buttonNo, Guid id)
        {
            if (buttonYes != null)
            {
                try
                {
                    var resourceKey = LocalizationService.GetResourceKey(id);
                    LocalizationService.DeleteLocaleResourceKey(resourceKey);
                    Context.SaveChanges();
                    ShowSuccess("Resource Deleted");
                }
                catch (Exception ex)
                {
                    Context.RollBack();
                    LoggingService.Error(ex);
                    ShowError(ex.Message);
                }
            }

            return(RedirectToAction("ManageResourceKeys"));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteResource(string buttonYes, string buttonNo, Guid id)
        {
            if (buttonYes != null)
            {
                using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
                {
                    try
                    {
                        var resourceKey = LocalizationService.GetResourceKey(id);
                        LocalizationService.DeleteLocaleResourceKey(resourceKey);
                        unitOfWork.Commit();
                        ShowSuccess("Resource Deleted");
                    }
                    catch (Exception ex)
                    {
                        unitOfWork.Rollback();
                        LoggingService.Error(ex);
                        ShowError(ex.Message);
                    }
                }
            }

            return(RedirectToAction("ManageResourceKeys"));
        }