Browse Source

Added max storage to service data page

feature/billing
Teknikode 7 months ago
parent
commit
d6a2e968e8
  1. 3
      Teknik/Areas/User/Controllers/UserController.cs
  2. 4
      Teknik/Areas/User/ViewModels/ViewServiceDataViewModel.cs
  3. 2
      Teknik/Areas/User/Views/User/ViewServiceData.cshtml

3
Teknik/Areas/User/Controllers/UserController.cs

@ -272,6 +272,9 @@ namespace Teknik.Areas.Users.Controllers @@ -272,6 +272,9 @@ namespace Teknik.Areas.Users.Controllers
{
ViewBag.Title = "Service Data";
ViewBag.Description = "Viewing all of your service data";
model.CurrentUploadStorage = _dbContext.Uploads.Where(u => u.UserId == user.UserId).Sum(u => u.ContentLength);
model.MaxUploadStorage = user.UploadSettings.MaxUploadStorage ?? _config.UploadConfig.MaxStorage;
model.Uploads = _dbContext.Uploads.Where(u => u.UserId == user.UserId).OrderByDescending(u => u.DateUploaded).ToList();

4
Teknik/Areas/User/ViewModels/ViewServiceDataViewModel.cs

@ -10,6 +10,10 @@ namespace Teknik.Areas.Users.ViewModels @@ -10,6 +10,10 @@ namespace Teknik.Areas.Users.ViewModels
{
public DateTime LastSeen { get; set; }
public long MaxUploadStorage { get; set; }
public long CurrentUploadStorage { get; set; }
public List<Upload.Models.Upload> Uploads { get; set; }
public List<Paste.Models.Paste> Pastes { get; set; }

2
Teknik/Areas/User/Views/User/ViewServiceData.cshtml

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
<div class="tab-pane active" id="uploads">
<br />
<div class="row">
<div class="col col-sm-12"><p>Total Upload Size: @StringHelper.GetBytesReadable(Model.Uploads.Sum(u => u.ContentLength))</p></div>
<div class="col col-sm-12"><p>Current Upload Storage Used: @StringHelper.GetBytesReadable(Model.CurrentUploadStorage) / @StringHelper.GetBytesReadable(Model.MaxUploadStorage)</p></div>
</div>
<br />
@foreach (Teknik.Areas.Upload.Models.Upload upload in Model.Uploads)

Loading…
Cancel
Save