示例#1
0
文件: User.cs 项目: gs1993/SO
 public User(string aboutMe, int?age, DateTime creationDate, string displayName, DateTime lastAccessDate,
             string location, int reputation, int views, string websiteUrl, int createdPostCount, VoteSummary voteSummary)
 {
     AboutMe          = aboutMe;
     Age              = age;
     CreationDate     = creationDate;
     DisplayName      = displayName;
     LastAccessDate   = lastAccessDate;
     Location         = location;
     Reputation       = reputation;
     Views            = views;
     WebsiteUrl       = websiteUrl;
     CreatedPostCount = createdPostCount;
     VoteSummary      = voteSummary;
 }
示例#2
0
文件: User.cs 项目: gs1993/SO
        public static Result <User> Create(string aboutMe, int?age, DateTime creationDate, string displayName, DateTime lastAccessDate,
                                           string location, int reputation, int views, string websiteUrl, int createdPostCount, VoteSummary voteSummary)
        {
            //TODO: add length validation

            if (creationDate > DateTime.UtcNow)
            {
                return(Result.Failure <User>("Invalid user creation date"));
            }

            if (lastAccessDate > DateTime.UtcNow)
            {
                return(Result.Failure <User>("Invalid user last access date"));
            }

            return(Result.Success(new User(aboutMe, age, creationDate, displayName, lastAccessDate, location, reputation,
                                           views, websiteUrl, createdPostCount, voteSummary)));
        }