public JsonResult AutoComplete(string prefix)
 {
     try
     {
         List <UserInfo>  usrList = (List <UserInfo>)UserBL.GetUsers();
         List <GroupInfo> grpList = (List <GroupInfo>)GroupBL.GetGroups();
         prefix = prefix.ToLower();
         var reciverUsrList = (from N in usrList
                               where N.Email.ToLower().StartsWith(prefix)
                               select new { Recipient = N.Email });
         var reciverGrpList = (from N in grpList
                               where N.Name.ToLower().StartsWith(prefix)
                               select new { Recipient = N.Name });
         var reciverList = reciverUsrList.Concat(reciverGrpList);
         return(Json(reciverList));
     }
     catch (Exception e)
     {
         TempData["sErrMsg"] = e.Message;
         return(Json("Something unintended happend, try again."));
         //return Redirect("~/");
     }
 }
Example #2
0
 public List <Group> GetGroups(int Id)
 {
     return(groupBL.GetGroups(Id));
 }