Ejemplo n.º 1
0
        public ActionResult Search(string name, string gender, string city, string region, string purchaseFrom, string purchaseUntil, string classification, string seller)
        {
            LoadDropDownFiltersBag();

            ICustomerRepository customerRepository = new CustomerRepository(_connectionString);
            var customerApp = new CustomerApplication(customerRepository);

            if (Session["userIsAdmin"] != null && !Convert.ToBoolean(Session["userIsAdmin"].ToString()) &&
                Session["userId"] != null)
            {
                seller = Session["userId"].ToString();
            }

            return(View("Index", customerApp
                        .SearchCustomers(name, gender.ToInt32(), city.ToInt32(), region.ToInt32(), purchaseFrom.ToDateTime(), purchaseUntil.ToDateTime(), classification.ToInt32(), seller.ToInt32())
                        .Select(c => CustomerEntityToModel(c))));
        }