Exemple #1
0
 public async Task UpdateAsync(Note record)
 {
     var newRecord = new JsonValueTableEntity
     {
         Value        = record.ToJson(),
         PartitionKey = PartitionKey,
         RowKey       = record.RowId
     };
     await _repository.Update(newRecord);
 }
Exemple #2
0
        public async Task SaveBlogInfo(Blog blog)
        {
            blog.RowKey       = "primary";
            blog.PartitionKey = "blogs";
            var exists = await azureTableStorage.GetItem("blogs", "primary");

            if (exists != null)
            {
                await azureTableStorage.Update(blog);
            }
            else
            {
                await azureTableStorage.Insert(blog);
            }
        }
Exemple #3
0
 public async Task UpdateAsync(UserProfile userProfile)
 {
     userProfile.RowKey       = userProfile.Id.ToString();
     userProfile.PartitionKey = userProfile.UserId;
     await _repository.Update(userProfile);
 }
Exemple #4
0
        public async Task <IActionResult> Committee(string id)
        {
            var viewModel = new CommitteeViewModel();

            try
            {
                if (string.IsNullOrWhiteSpace(id))
                {
                    viewModel.ErrorMessage = "Please enter the code.";
                }
                else if (id.Length != 5)
                {
                    viewModel.ErrorMessage = "Please enter the valid code.";
                }
                else
                {
                    var committeeMembers = await _azureTableStorage.GetList();

                    var member = committeeMembers.FirstOrDefault(x => x.Code == id);
                    if (member == null)
                    {
                        viewModel.ErrorMessage = "Code is invalid. No Record Found.";
                    }
                    else
                    {
                        if (member.Number == 0)
                        {
                            var random     = new Random(100000);
                            var nextNumber = random.Next(1, 11);
                            while (committeeMembers.Any(x => x.Number == nextNumber))
                            {
                                nextNumber = random.Next(1, 11);
                            }


                            member.Number = nextNumber;
                            await _azureTableStorage.Update(member);
                        }

                        viewModel.CommitteeMembers = committeeMembers.Where(x => x.Number != 0).ToList();
                        viewModel.Number           = member.Number;
                    }
                }
            }
            catch (Exception ex)
            {
                viewModel.ErrorMessage = ex.Message;

                //var innerException = ex.InnerException;
                //if (innerException != null)
                //{
                //    var sb = new StringBuilder("<br /><ul>");
                //    while (ex.InnerException != null)
                //    {
                //        sb.Append($"<li>{innerException.Message}</li>");
                //        innerException = innerException.InnerException;
                //    }
                //    sb.Append("</ul>");
                //    viewModel.ErrorMessage = sb.ToString();
                //}
            }


            //check if code exist
            return(PartialView("Committee", viewModel));
        }
Exemple #5
0
 public async Task Update(Post entity)
 {
     entity.PartitionKey = GetPartitionKey(entity);
     await azureTableStorage.Update(entity);
 }
 public async Task <bool> UpdateQueue(PickupQueue queue)
 {
     return(await _client.Update(queue));
 }
Exemple #7
0
 public async Task UpdateAsync(string userId, ProductInfo productInfo)
 {
     productInfo.RowKey       = productInfo.Id.ToString();
     productInfo.PartitionKey = userId;
     await _repository.Update(productInfo);
 }