public ActionResult DeleteLanguage(string buttonYes, string buttonNo, Guid id) { if (buttonYes != null) { try { LocalizationService.Delete(LocalizationService.Get(id)); Context.SaveChanges(); ShowSuccess("Language Deleted"); } catch (Exception ex) { Context.RollBack(); ShowError(ex.Message); LoggingService.Error(ex); } } return(RedirectToAction("Index")); }
public ActionResult DeleteLanguage1(Guid Id) { var language = LocalizationService.Get(Id); if (language == null) { return(RedirectToAction("Index")); } using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork()) { try { LocalizationService.Delete(language); unitOfWork.Commit(); LocalizationService.Clear(); TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel { Message = LocalizationService.GetResourceString("Xóa gói ngôn ngữ thành công"), MessageType = GenericMessages.success }; return(RedirectToAction("Index")); } catch (Exception ex) { unitOfWork.Rollback(); LoggingService.Error(ex.Message); TempData[AppConstants.MessageViewBagName] = new GenericMessageViewModel { Message = LocalizationService.GetResourceString("Có lỗi xảy ra!"), MessageType = GenericMessages.warning }; } } return(View(language)); }
public ActionResult DeleteLanguage(string buttonYes, string buttonNo, Guid id) { if (buttonYes != null) { using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork()) { try { LocalizationService.Delete(LocalizationService.Get(id)); unitOfWork.Commit(); ShowSuccess("Language Deleted"); } catch (Exception ex) { unitOfWork.Rollback(); ShowError(ex.Message); LoggingService.Error(ex); } } } return(RedirectToAction("Index")); }