Пример #1
0
 public JsonResult UploadImagePraise(IFormFile file)
 {
     this.Upload(new TfUploadModel()
     {
         FilePath = TfSettings.GetSettings("PrayerForums", "ImageUploadTemp"),
         File     = file
     }, false);
     return(this.Conclude());
 }
Пример #2
0
 public override void HandleModel()
 {
     this.Request.Entity.active = 1;
     this.Request.Update();
     this.Request.ClearCase();
     this.Request.SelectToEntity();
     TfEmail.Send(
         TfSettings.GetSettings("PrayerForum", "ChurchEmail").ToString(),
         "request_activate_email",
         this.Request.Entity.ToDictionary());
 }
Пример #3
0
        private string ImageUrl(string imageUrl, int?id)
        {
            if (this.Praise.image_url.IsEmpty())
            {
                return(string.Empty);
            }

            var tempPath  = TfSettings.GetSettings("PrayerForums", "ImageUploadTemp");
            var imagePath = TfSettings.GetSettings("PrayerForums", "ImageUploadPraise");
            var fileName  = Path.GetFileName(imageUrl);

            Directory.CreateDirectory(imagePath);

            var oldPath = Path.Combine(tempPath, fileName);
            var newPath = Path.Combine(imagePath, $"praise_{id}{Path.GetExtension(fileName)}");

            File.Move(oldPath, newPath);

            return($"{TfSettings.Web.SiteUrl}/{newPath.Replace("\\", "/").Replace("wwwroot/", "")}");
        }