예제 #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)));
        }