public async Task <PromotionActionDto> GetActionWithId(Guid id) { using (var session = _cassandraDbConnectionProvider.Connect()) { string cql = "SELECT * FROM actions WHERE id = ?;"; var action = await _cassandraQueryProvider.QuerySingleOrDefault <ActionModel>(session, cql, id); var actionToReturn = new PromotionActionDto { Id = action.Id.ToString(), Type = action.Type, Flat = action.Flat, Percentage = action.Percentage, FreeShip = action.FreeShip, Items = action.Items.ToArray() }; return(actionToReturn); } }
public async Task <bool> Login(string username, string password) { using (var session = _cassandraDbConnectionProvider.Connect()) { string cql = "SELECT * FROM users WHERE username = ?"; var user = await _cassandraQueryProvider.QuerySingleOrDefault <User>(session, cql, username); if (user == null) { return(false); } if (!ValidatePassword(user, password)) { return(false); } } return(true); }