27 lines
No EOL
857 B
C#
27 lines
No EOL
857 B
C#
using System;
|
|
using Website.Extensions;
|
|
using Website.Models.Git;
|
|
|
|
namespace Website.ViewModels {
|
|
public class GitCommitViewModel {
|
|
public GitCommitViewModel(Repository repo, Branch branch, Commit commit) {
|
|
RepositoryName = repo.Name;
|
|
RepositoryUrl = repo.Url;
|
|
BranchName = branch.Name;
|
|
Hash = commit.Id;
|
|
CommitUrl = commit.Url;
|
|
CommitMessage = commit.Message;
|
|
Timestamp = FormatTimestamp(commit.Timestamp);
|
|
}
|
|
|
|
private static string FormatTimestamp(DateTimeOffset timestamp) => timestamp.ToString($@"HH:mm:ss on dddd \t\h\e d{timestamp.GetDaySuffix()} \o\f MMMM yyyy");
|
|
|
|
public string RepositoryName { get; }
|
|
public string RepositoryUrl { get; }
|
|
public string BranchName { get; }
|
|
public string Hash { get; }
|
|
public string CommitUrl { get; }
|
|
public string CommitMessage { get; }
|
|
public string Timestamp { get; }
|
|
}
|
|
} |