Пример #1
0
        public static void ChangeStaffViewedStatus(string key)
        {
            var statusMessage = String.Empty;

            try
            {
                var account = CloudStorageAccount.FromConfigurationSetting("TableDataConnectionString");

                var context = new StaffMessageDataServiceContext(account.TableEndpoint.ToString(), account.Credentials);

                var o = (from message in context.StaffMessages
                         where message.RowKey == key
                         select message).First();

                o.IsViewed = true;
                context.UpdateObject(o);
                context.SaveChanges();
            }
            catch (DataServiceRequestException ex)
            {
                statusMessage = "Unable to connect to the table storage server. Please check that the service is running.<br>"
                                + ex.Message;
            }
        }