public List <SaleDto> GetSale(int userId) { var result = ReadOnlyWorkspace.Query <Sale>(x => x.UserId == userId).Select(x => new SaleDto { Total = x.Total, UserId = x.UserId, Amount = x.Amount, }).ToList(); return(result); }
List <SaleDto> ISaleRepository.GetDto(int userId) { var result = ReadOnlyWorkspace.Query <Sale>(x => x.UserId == userId).Select(x => new SaleDto { Id = x.Id, Total = x.Total, Amount = x.Amount, Date = x.Date }).ToList(); return(result); }
public List <CartDto> GetItemCart(int userId) { var result = ReadOnlyWorkspace.Query <CartItem>(x => x.UserId == userId).Select(x => new CartDto { Id = x.Id, UserId = x.UserId, ProductId = x.ProductId, Amount = x.Amount, SubTotal = x.SubTotal, Product = x.Product, }).ToList(); return(result); }
public UserDto GetIdentity(int userId) { var user = ReadOnlyWorkspace.Query <User>(x => x.Id == userId, x => x.Roles).FirstOrDefault(); var roleId = user.Roles.First().RoleId; var result = new UserDto { Id = user.Id, UserName = user.UserName, Email = user.Email }; if (user.Roles.Any()) { var role = ReadOnlyWorkspace.Query <Role>(x => x.Id == roleId).FirstOrDefault(); if (role != null) { result.Role = role.Name; } } return(result); }
public User GetUserByName(string name) { var user = ReadOnlyWorkspace.Query <User>().FirstOrDefault(x => x.UserName == name); return(user); }
public List <User> GetUsers() { return(ReadOnlyWorkspace.Query <User>().ToList()); }