Esempio n. 1
0
        private string Encrypt(byte[] versionBytes)
        {
            var cipherBytes = MachineKeySectionWrapper.Encrypt(versionBytes);
            var hex         = MachineKeySectionWrapper.ByteArrayToHexString(cipherBytes);

            return(hex);
        }
Esempio n. 2
0
        public ActionResult PostMessageModified(int messageId, string version)
        {
            var versionEncryptedBytes = MachineKeySectionWrapper.HexStringToByteArray(version);
            var versionBytes          = MachineKeySectionWrapper.Decrypt(versionEncryptedBytes);

            var yesterday = DateTime.Now.AddDays(-1);

            var message = new SimplifiedMessage
            {
                Id       = messageId,
                Version  = versionBytes,
                Created  = yesterday,
                Modified = yesterday,
                Number   = yesterday.Millisecond.ToString()
            };

            try
            {
                MessageRepository.UpdateMessage(message);
            }
            catch (ConcurrencyException)
            {
                return(new HttpStatusCodeResult((int)HttpStatusCode.InternalServerError, "Concurrency error"));
            }

            return(this.Json(message, JsonRequestBehavior.AllowGet));
        }