public ActionResult UpdateSmallGroup(int id, int curgrpid, int targrpid, string list) { string[] arr = list.Split(','); int[] selectedIds = Array.ConvertAll(arr, int.Parse); var m = new SubgroupModel(id); var a = selectedIds; //Add members to subgroup var tarsgname = db.MemberTags.Single(mt => mt.Id == targrpid).Name; var cursgname = db.MemberTags.Single(mt => mt.Id == curgrpid).Name; var q2 = from om in m.OrgMembers() where om.OrgMemMemTags.All(mt => mt.MemberTag.Id == curgrpid) where a.Contains(om.PeopleId) select om; foreach (var om in q2) { om.AddToGroup(db, tarsgname); om.RemoveFromGroup(db, cursgname); } db.SubmitChanges(); m.groupid = targrpid; m.ingroup = m.GetGroupDetails(targrpid).Name; return(Json(m)); }
public ActionResult MoveSubgroupView(int id, int grpid, string list, string selectedTimeslot) { var m = new SubgroupModel(id); var details = m.GetGroupDetails(grpid); m.groupid = grpid; m.GroupName = details.Name; var date = DateTime.Parse(selectedTimeslot); m.TimeSlot = date.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss"); string[] arr = list.Split(','); int[] selectedIds = Array.ConvertAll(arr, int.Parse); m.SelectedPeopleIds = selectedIds; return(PartialView(m)); }