public Spin(SpinDTO spin, User user) { PlayedAmount = spin.PlayedAmount; Win = spin.Win; TotalAmount = spin.TotalAmount; TimeStamp = spin.TimeStamp; User = user; }
public async Task <Result <List <SpinDTO> > > GetSpins(string userId) { var user = await context.Users.FindAsync(Guid.Parse(userId)); if (user == null) { return(Result <List <SpinDTO> > .CreateFailed( HttpStatusCode.NotFound, "Αδυναμία ανάκτησης χρήστη")); } var spins = await context.Spins.Where(x => x.User == user).ToListAsync(); if (spins == null) { return(Result <List <SpinDTO> > .CreateFailed( HttpStatusCode.NotFound, "Αδυναμία ανάκτησης χρήστη")); } return(Result <List <SpinDTO> > .CreateSuccessful(SpinDTO.ToDTO(spins))); }