Exemplo n.º 1
0
 public JsonResult SendMessage(string username, string chatType, string message)
 {
     try
     {
         ChatServiceClient client = new ChatServiceClient(chatType);
         client.SubmitChat(new Message
         {
             Comment = message,
             ChatType = (ChatType) Enum.Parse(typeof (ChatType), chatType),
             Submitter = username
         });
         return Json(new WcfResult("Message sent", true), JsonRequestBehavior.AllowGet);
     }
     catch (FaultException ex)
     {
         return Json(new WcfResult(ex.Message, false), JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex)
     {
         return Json(new WcfResult(ex.Message, false), JsonRequestBehavior.AllowGet);
     }
     
 }