public JsonResult GetMessages(string forId) { if (string.IsNullOrEmpty(forId)) { return(Json(new { success = true, messages = new System.Collections.Generic.List <Entities.Message>() })); } var messages = new Service.SchwackService().GetMessages(new System.Guid(forId)); return(Json(new { success = true, messages = messages })); }
public JsonResult SignIn(string who) { try { var users = new Service.SchwackService().SignIn(who); var user = users.SingleOrDefault(w => w.Name.ToLower() == who.ToLower()); return(Json(new { success = true, user = user, onlineUsers = users })); } catch (System.ApplicationException ex) { if (ex.Message == "100") { return(Json(new { success = false, message = "User already exists. Try again." })); } return(Json(new { success = false, message = "I bent my wookie! </ralph>" })); } }
public JsonResult GetUsers() { var users = new Service.SchwackService().GetUsers(); return(Json(new { success = true, users = users })); }
public JsonResult PostMessage(string from, string to, string message) { var postMessage = new Service.SchwackService().PostMessage(new System.Guid(from), new System.Guid(to), message); return(Json(new { success = true, message = postMessage })); }