예제 #1
0
        public IList <ApplicationRole> FindByUser(int MemberId)
        {
            try
            {
                var result = from q in accountrepo.Find(MemberId).ApplicationUserRole
                             where q.Void == false
                             select q.ApplicationRole;

                return(ToList(result.AsQueryable()));
            }
            catch (Exception ex)
            {
                WriteErrorLog(ex);
                throw ex;
            }
        }
        //Geeft de volledige naam terug van een gebruiker
        public string GetNameById(long id)
        {
            var    query = _repository.Find(id);
            string name  = query.FirstName.ToString() + " " + query.LastName.ToString();

            return(name);
        }
예제 #3
0
        public IActionResult Index(string email = null, string username = null, string order = null)
        {
            List <OrderViewModel> orderViewModel = new List <OrderViewModel>();

            if (email != null || username != null || order != null)
            {
                var          user   = new ApplicationUser();
                List <Order> orders = new List <Order>();

                if (order != null)
                {
                    orders = _order.List(o => o.Id == Convert.ToInt32(order));
                }
                else
                {
                    if (email != null)
                    {
                        user = _user.Find(u => u.Email.ToLower().Contains(email.ToLower()));
                    }
                    else
                    {
                        if (username != null)
                        {
                            user = _user.Find(u => u.FirstName.ToLower().Contains(username.ToLower()));
                        }
                    }
                }
                if (user != null || orders.Count > 0)
                {
                    if (orders.Count == 0)
                    {
                        orders = _order.ListRelatedWithUser(user.Id);
                    }

                    foreach (Order item in orders)
                    {
                        OrderViewModel ovm = new OrderViewModel
                        {
                            Order        = item,
                            OrderDetails = _orderDetail.ListWithOrder(item.Id)
                        };
                        orderViewModel.Add(ovm);
                    }
                }
            }
            else
            {
                List <Order> orders = _order.ListOrders();

                foreach (var item in orders)
                {
                    OrderViewModel ovm = new OrderViewModel
                    {
                        Order        = item,
                        OrderDetails = _orderDetail.ListWithOrder(item.Id)
                    };
                    orderViewModel.Add(ovm);
                }
            }

            return(View(orderViewModel));
        }
예제 #4
0
 public ApplicationUser Find(int id)
 {
     return(applicationUserRepository.Find(id));
 }
예제 #5
0
 public IEnumerable <ApplicationUser> Find(Expression <Func <ApplicationUser, bool> > predicate)
 {
     return(_applicationUserRepository.Find(predicate));
 }