public async Task <JsonResult> GetConnectionSingleByMID(string ID) { try { var data = ConnectionServices.GetByMemberSingleID(ID); var vmModel = new List <ConnectionViewModel>(); foreach (var model in data) { var temp = new ConnectionViewModel() { ID = model.ID.ToString(), GroupName = model.ConnectionName }; foreach (var member in model.Members) { //assign userinformationmodel var vm = new UserInformationViewModel() { User = member.UserID.ToString() }; temp.PushMembers(member, vm); } vmModel.Add(temp); } return(Json(new { success = true, data = vmModel }, JsonRequestBehavior.AllowGet)); } catch (Exception e) { Console.Write(e); return(Json(new { success = false, message = MessageUtility.ServerError() }, JsonRequestBehavior.AllowGet)); } }
public async Task <JsonResult> GetConnectionMemberUpdatedLocation(string connection) { try { ConnectionViewModel param = json_serializer.Deserialize <ConnectionViewModel>(connection); var connectionData = ConnectionServices.GetByID(param.ID); var temp = new ConnectionViewModel() { ID = param.ID, GroupName = param.GroupName }; foreach (var member in connectionData.Members) { if (member.isArchived == false) { var vm = new UserInformationViewModel() { User = member.UserID.ToString(), }; temp.PushMembers(member, vm); } } return(Json(new { success = true, data = temp }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { success = false, message = MessageUtility.ServerError() }, JsonRequestBehavior.AllowGet)); } }