コード例 #1
0
 public MotivationByIdEntity(string userId, string motivationId, string motivationMessage, MotivationType motivationType)
 {
     PartitionKey      = userId;
     RowKey            = motivationId;
     MotivationMessage = motivationMessage;
     UserId            = userId;
     MotivationType    = motivationType.ToString();
 }
コード例 #2
0
        public async Task <IEnumerable <Motivation> > GetMotivationsForType(MotivationType motivationType)
        {
            var motivationsByType = await _motivationEntityStore.GetByPartitionAsync(motivationType.ToString());

            return(motivationsByType.Select(x => new Motivation
            {
                Id = new Guid(x.RowKey),
                MotivationType = (MotivationType)Enum.Parse(typeof(MotivationType), x.PartitionKey, true),
                MotivationMessage = x.MotivationMessage
            }));
        }
コード例 #3
0
        public Task InsertMotivation(string userId, MotivationType motivationType, string message)
        {
            var newMotivationId  = Guid.NewGuid().ToString();
            var motivationEntity = new MotivationEntity(motivationType.ToString(), newMotivationId, message, userId);

            var motivationEntityTask = _motivationEntityStore.SetAsync(motivationEntity);

            var motivationByIdEntity = new MotivationByIdEntity(userId, newMotivationId, message, motivationType);

            var motivationByIdEntityTask = _motivationByIdEntityStore.SetAsync(motivationByIdEntity);

            return(Task.WhenAll(new Task[] { motivationEntityTask, motivationByIdEntityTask }));
        }
コード例 #4
0
 public ScheduledPushEntity(string partitionKey, string rowKey, MotivationType motivationType)
 {
     PartitionKey   = partitionKey;
     RowKey         = rowKey;
     MotivationType = motivationType.ToString();
 }