Пример #1
0
 public ActionResult ChangePassword(ChangePasswordDto changePasswordDto)
 {
     if (!ModelState.IsValid)
     {
         return(Json(JsonDialogResult.CreateFail(HtmlConstants.DIALOG_VALIDATION_SUMMARY, ValidationSummaryExtensions.CustomValidationSummary(ModelState).ToString())));
     }
     GetUnitOfWork().StartTransaction();
     GetService().ChangePassword(changePasswordDto);
     GetUnitOfWork().EndTransaction();
     GetTempDataManager().SetTempData(TempDataConstants.MESSAGE, Message.CreateSuccessMessage(MessageKeyConstants.INFO_CHANGE_PASSWORD_SUCCESSFUL_MESSAGE));
     return(Json(JsonDialogResult.CreateSuccess(null, Url.Action(WebConstants.VIEW_PROFILE, WebConstants.CONTROLLER_USER, new { id = changePasswordDto.UserId }))));
 }
Пример #2
0
        public virtual ActionResult FileReferenceConfirmed(DialogDto dialogDto, HttpPostedFileBase file)
        {
            // TODO change the implementation
            string fileName = null;
            Stream stream   = null;

            if (file != null)
            {
                fileName = file.FileName;
                stream   = file.InputStream;
            }
            try
            {
                GetUnitOfWork().StartTransaction();
                PhotoResourceDto photoResourceDto = null;// (PhotoResourceDto)GetService().UploadFile(dialogDto.Id, typeof(T), fileName, stream);
                GetUnitOfWork().EndTransaction();
                return(Json(new JsonFileSelectDialogResult(true, photoResourceDto.GetRelativeThumbnailFile(), photoResourceDto.GetRelativeFilePath(), JsonRefreshMode.IMAGE_TO_RICHTEXTBOX)));
            }
            catch (ValidationException ex)
            {
                return(Json(new JsonDialogResult(false, HtmlConstants.DIALOG_VALIDATION_SUMMARY, ValidationSummaryExtensions.CustomValidationSummary(ex.Message).ToString())));
            }
        }
Пример #3
0
 public ActionResult Upload(PhotoResourceDto photoResourceDto, string returnFileType, HttpPostedFileBase file)
 {
     try
     {
         PhotoResourceDto extendedPhotoResourceDto = CreatePhotoResourceDto(file);
         GetUnitOfWork().StartTransaction();
         extendedPhotoResourceDto = GetService().Persist(extendedPhotoResourceDto);
         GetUnitOfWork().EndTransaction();
         if ("thumbnail".Equals(returnFileType))
         {
             return(Json(JsonUploadResult.CreateSuccess(extendedPhotoResourceDto.Id, null, JsonRefreshMode.NONE, extendedPhotoResourceDto.GetAbsoluteThumbnailFilePath(), extendedPhotoResourceDto.GetRelativeThumbnailFile())));
         }
         return(Json(JsonUploadResult.CreateSuccess(extendedPhotoResourceDto.Id, null, JsonRefreshMode.NONE, extendedPhotoResourceDto.GetAbsoluteFilePath(), extendedPhotoResourceDto.GetRelativeFilePath())));
     }
     catch (ValidationException ex)
     {
         return(Json(JsonDialogResult.CreateFail(HtmlConstants.DIALOG_VALIDATION_SUMMARY, ValidationSummaryExtensions.CustomValidationSummary(ex.Message).ToString())));
     }
 }
Пример #4
0
 protected override ActionResult RedirectToActionAfterClientFailCreate(T dto, AfterFailSaveParam afterFailSaveParam)
 {
     return(Json(JsonDialogResult.CreateFail(HtmlConstants.DIALOG_VALIDATION_SUMMARY, ValidationSummaryExtensions.CustomValidationSummary(ModelState).ToString())));
 }
Пример #5
0
 protected virtual ActionResult RedirectToActionAfterFailDelete(AfterFailSaveParam afterFailSaveParam)
 {
     return(Json(JsonDialogResult.CreateFail(HtmlConstants.DIALOG_VALIDATION_SUMMARY, ValidationSummaryExtensions.CustomValidationSummary(afterFailSaveParam.ValidationMessage).ToString())));
 }
Пример #6
0
 protected virtual ActionResult RedirectToActionAfterFailDelete(string validationResult)
 {
     return(Json(new JsonDialogResult(false, HtmlConstants.DIALOG_VALIDATION_SUMMARY, ValidationSummaryExtensions.CustomValidationSummary(validationResult).ToString())));
 }
Пример #7
0
 protected override ActionResult RedirectToActionAfterClientFailCreate(T dto, string validationResult)
 {
     return(Json(new JsonDialogResult(false, HtmlConstants.DIALOG_VALIDATION_SUMMARY, ValidationSummaryExtensions.CustomValidationSummary(ModelState).ToString())));
 }