public ActionResult AssignUser(UserStorageWarehousingRequest data) { var order = _da.GetById(data.orderId); var users = _da.GetAssignUser(data.orderId); if (order == null) { return(Json(new JsonMessage() { Erros = true, Message = "Order not found" })); } var userAdd = data.userIds.Where(m => order.StorageWarehousingUsers.All(n => n.UserId != m)).ToList(); var userRemove = order.StorageWarehousingUsers.Where(m => data.userIds.All(n => n != m.UserId)).ToList();//get _da.AddAssignUser(data.orderId, userAdd); _da.RemoveAssignUser(userRemove); _da.Save(); return(Json(new JsonMessage() { Erros = false }, JsonRequestBehavior.AllowGet)); }