public DeleteLanguageResponse DeleteLanguage(DeleteLanguageRequest request)
        {
            var response = new DeleteLanguageResponse();
            try
            {
                Guard.ArgNotNull(request, "request");
                Language language = _unitOfWork.LanguageRepository.GetById(request.Id);

                Guard.ArgNotNull(language, "language");

                _unitOfWork.LanguageRepository.Delete(language);
                _unitOfWork.Save();

                response.Success = true;
                Logger.LogInfo("Successfully deleted Language Id: " + request.Id.ToString(), LogType.General);
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.FailureInformation = ex.Message;
                Logger.LogError("DeleteLanguage method failed", ex);
            }

            return response;
        }
Exemplo n.º 2
0
        public DeleteLanguageResponse DeleteLnaguage(DeleteLanguageRequest request)
        {
            DeleteLanguageResponse response = new DeleteLanguageResponse();

            try
            {
                _languageRepository.Delete(request.LanguageId);
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = ex.Message;
            }
            return(response);
        }
Exemplo n.º 3
0
        public ActionResult Delete(int id)
        {
            DeleteLanguageRequest request = new DeleteLanguageRequest()
            {
                LanguageId = id
            };
            DeleteLanguageResponse response = _languageService.DeleteLnaguage(request);

            if (response.Success)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                LanguageListPageViewModel model = new LanguageListPageViewModel();
                model.Success = false;
                model.Message = response.Message;
                return(View("Index", model));
            }
        }