public string UpdateMessage(Stream message) { try { MessageBox objInput = JSonHelper.JsonDeserialize<MessageBox>(new StreamReader(message).ReadToEnd()); if (System.Configuration.ConfigurationManager.AppSettings[objInput.Pin] == null) { return "Invalid PIN"; } if (objInput.Pin != null && objInput.Pin.Length > 0) { MessageInfo obj = new MessageInfo(); MessageBLL objbll = new MessageBLL(); obj.MessageId = objInput.MessageId; obj.IsMessageRead = objInput.IsMessageRead; obj.Pin = System.Configuration.ConfigurationManager.AppSettings[objInput.Pin].ToString(); int i = objbll.updatemessage(obj); return "Updated successfully"; } else { return "Pin is a required field"; } } catch (Exception ex) { return ex.Message; } }