public string DeleteMessage(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) { MessageBox obj2 = new MessageBox(); List<MessageInfo> objcol = new List<MessageInfo>(); MessageInfo obj = new MessageInfo(); MessageBLL objbll = new MessageBLL(); obj.FromId = objInput.FromId; obj.MessageComposeId = objInput.MessageComposeId; obj.userType = objInput.userType; obj.Pin = System.Configuration.ConfigurationManager.AppSettings[objInput.Pin].ToString(); int i = objbll.DeleteMessages(obj); if (i > 0) return "Delete sucessful"; else return "Delete Unsucessful"; } else { return "Pin is a required field"; } } catch (Exception ex) { return "Unable to delete. Please try again later"; } }