package model.dao;

import java.util.ArrayList;

import exceptions.ExceptionSearchId;
import model.entity.AssignOrderToUser;
import model.entity.Order;
import model.entity.User;

public class UserManager {
	private ArrayList<User> userList;
	private ArrayList<AssignOrderToUser> assignOrderList;
	
	public UserManager(){
		userList = new ArrayList<>();
		assignOrderList = new ArrayList<>();
	}
	// crud de ususario
		public User createUser(int id, String name, String password, ArrayList<Order> orderList, boolean state) {
			return new User(id, name, password, orderList, state);
		}

		public void addUser(User user) {
			userList.add(user);
		}

		public User searchUser(int id) throws ExceptionSearchId {
			for (User user : userList) {
				if (user.getId() == id) {
					return user;
				}
			}
			throw new ExceptionSearchId();
		}

		public void deleteUser(User user) {
			userList.remove(user);
		}

		public void editUser(User user, int id) {
			userList.set(id, user);
		}
public static AssignOrderToUser createAssignOrder(Order order, User user){
	return new AssignOrderToUser(order, user);
}
public void addAssignProductoToOwner(AssignOrderToUser assignOrder) {
	assignOrderList.add(assignOrder);
}

public AssignOrderToUser searchAssignProductoToOwner(int id) throws ExceptionSearchId {
	for (AssignOrderToUser assignOrder : assignOrderList) {
		if (assignOrder.getUser().getId() == id) {
			return assignOrder;
		}
	}
	throw new ExceptionSearchId();
}

public void deleteAssignProduct(AssignOrderToUser assignOrder) {
	assignOrderList.remove(assignOrder);
}
}

@@ -148,24 +148,54 @@
 ity.Order;%0D%0A
+import model.entity.Product;%0D%0A
 import model
@@ -1194,29 +1194,25 @@
 ddAssign
-ProductoToOwn
+OrderToUs
 er(Assig
@@ -1293,87 +1293,129 @@
 ic A
-ssignOrderToUser searchAssignProductoToOwner(int id) throws ExceptionSearchId %7B
+rrayList%3COrder%3E searchAssignOrderToUser(int id) throws ExceptionSearchId %7B%0D%0A%09ArrayList%3COrder%3E orders = new ArrayList%3C%3E();
 %0D%0A%09f
@@ -1522,33 +1522,70 @@
 %0D%0A%09%09
-%09return assignOrder;%0D%0A%09%09%7D
+    orders.add(assignOrder.getOrder());%0D%0A%09%09%7D%0D%0A%09%09return orders;
 %0D%0A%09%7D

modifique metodos de UserManager