Skip to content

Commit

Permalink
Sort on rename
Browse files Browse the repository at this point in the history
  • Loading branch information
madskristensen committed Sep 11, 2017
1 parent 5a0bac2 commit d7eb52e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A photo gallery site implemented in ASP.NET Core 2.0 Razor Pages.
- All major browsers fully supported (IE 10+)
- Social media integration (Facebook, Twitter, Pinterest)
- Follows best practices for web applications
- [See DareBoost report](https://www.dareboost.com/en/report/59b6d2080cf2502fdb8c0c92)
- [See DareBoost report](https://www.dareboost.com/en/report/59b6e5510cf2502fdb8c1ad5)

## Technical features
- High performance. Gets 100/100 points on Google PageSpeed Insights
Expand Down
3 changes: 3 additions & 0 deletions src/Models/Album.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public IPaginator Previous
}
}

/// <summary>
/// Sorts the photos in the album.
/// </summary>
public void Sort()
{
Photos = Photos.OrderBy(p => p.DisplayName).ToList();
Expand Down
2 changes: 2 additions & 0 deletions src/Pages/Photo.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public IActionResult OnPostRename(string albumName, string photoName)
System.IO.File.Move(file, newThumbnail);
}

Photo.Album.Sort();

return new RedirectResult($"~/photo/{WebUtility.UrlEncode(albumName).Replace('+', ' ')}/{newPhoto.DisplayName}/");

}
Expand Down

0 comments on commit d7eb52e

Please sign in to comment.