protected RemarkState(string state, RemarkUser user,
                       string description = null, Location location  = null,
                       RemarkPhoto photo  = null, DateTime?createdAt = null)
 {
     if (state.Empty())
     {
         throw new ArgumentException("State can not be empty.", nameof(state));
     }
     if (user == null)
     {
         throw new ArgumentException("User can not be null.", nameof(user));
     }
     if (description?.Length > 2000)
     {
         throw new ArgumentException("Description can not have more than 2000 characters.",
                                     nameof(description));
     }
     Id          = Guid.NewGuid();
     State       = state;
     User        = user;
     Description = description?.Trim() ?? string.Empty;
     Location    = location;
     Photo       = photo;
     CreatedAt   = createdAt.HasValue ? createdAt.Value : DateTime.UtcNow;
 }
Beispiel #2
0
 public void AddPhoto(RemarkPhoto photo)
 {
     if (photo == null)
     {
         return;
     }
     _photos.Add(photo);
     UpdatedAt = DateTime.UtcNow;
 }
Beispiel #3
0
 public void SetRenewedState(User user, string description = null,
                             RemarkPhoto photo             = null)
 => SetState(RemarkState.Renewed(RemarkUser.Create(user), description, photo));
Beispiel #4
0
 public void SetProcessingState(User user, string description = null,
                                RemarkPhoto photo             = null)
 => SetState(RemarkState.Processing(RemarkUser.Create(user), description, photo));
 public static RemarkState Resolved(RemarkUser user,
                                    string description = null, Location location = null, RemarkPhoto photo = null)
 => new RemarkState(Names.Resolved, user, description, location, photo);
 public static RemarkState Processing(RemarkUser user,
                                      string description = null, RemarkPhoto photo = null)
 => new RemarkState(Names.Processing, user, description, photo: photo);