public virtual void Create(User user) { if (user == null) throw new ArgumentNullException("user"); Dispatcher.Dispatch(AddUser.CreateFrom(user)); Cache.AddToList(user); }
public static AddUser CreateFrom(User user) { return new AddUser { EmailAddress = user.EmailAddress, Id = user.Id, Name = user.Name, UpdatedDate = user.UpdatedDate }; }
public override void Create(User user) { Repository.HttpRequestor.Post(ConfigurationProvider.DataServiceLocation + "users", user); }
private void SaveTags(Log log, User user, Event @event, IEnumerable<Tag> tags) { foreach (var tag in tags) TagRepository.Create(new Tag { LogId = log.Id, LogName = log.Name, EventId = @event.Id, Date = @event.Date, Id = Guid.NewGuid(), Name = tag.Name, UserId = user.Id }); }
private void SaveMeasurements(User user, Log log, Event @event, IEnumerable<MeasurementData> values) { foreach (var value in values) MeasurementRepository.Create(new Measurement { Id = Guid.NewGuid(), GroupId = value.GroupId == Guid.Empty ? Guid.NewGuid() : value.GroupId, EventId = @event.Id, Date = @event.Date, Name = value.Name, Quantity = value.Quantity, Unit = value.Unit, LogId = log.Id, LogName = log.Name, UserId = user.Id }); }
internal virtual string BuildMessage(string message, User user) { return user == null ? message : (user.EmailAddress + " - " + message); }
public void Warn(string message, User user = null, Exception exception = null) { Logger.Warn(BuildMessage(message, user), exception); }