コード例 #1
0
 public JsonResult UploadImagePraise(IFormFile file)
 {
     this.Upload(new TfUploadModel()
     {
         FilePath = TfSettings.GetSettings("PrayerForums", "ImageUploadTemp"),
         File     = file
     }, false);
     return(this.Conclude());
 }
コード例 #2
0
ファイル: ActivateModel.cs プロジェクト: apoloamri/DeskTiny
 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/", "")}");
        }