public async Task <ConfigurationObject> GetConfigurationObject(string key) { DataSet dataSet = await _storedProceduresExecutor.ExecuteQuery(StoredProceduresNames.GetConfiguration, new List <SqlParameter> { new SqlParameter("@key", key) }); return(ReadConfigurationObjectFromDataRow(dataSet)); }
public async Task <Meal> GetMealById(Guid id) { DataSet dataSet = await _storedProceduresExecutor.ExecuteQuery(StoredProceduresNames.GetMealById, new List <SqlParameter> { new SqlParameter("@mealId", id) }); return(ExtractMealFromDataSet(dataSet)); }
public async Task <IList <OrderProposition> > GetOrderPropositionsInWhichUserHasActualOffers(Guid userId) { DataSet dataSet = await _storedProceduresExecutor.ExecuteQuery(StoredProceduresNames.GetOrderPropositionsInWhichUserHasAvailableOffer, new List <SqlParameter>(1) { new SqlParameter("@userId", userId) }); return((from DataRow row in dataSet.Tables[0].Rows select _dataRowToObjectMapper.ConvertOrderProposition(row)).ToList()); }
public async Task <User> GetUser(Guid id) { DataSet dataSet = await _storedProceduresExecutor.ExecuteQuery(StoredProceduresNames.GetUserById, new List <SqlParameter> { new SqlParameter("@userId", id) }); User user = ExpandUserFromDataSet(dataSet); return(user); }
public async Task <IList <Order> > GetOrders() { DataSet dataSet = await _storedProceduresExecutor.ExecuteQuery(StoredProceduresNames.GetOrders, new List <SqlParameter>()); IList <Order> orders = new List <Order>(dataSet.Tables[0].Rows.Count); foreach (DataRow row in dataSet.Tables[0].Rows) { orders.Add(_dataRowToObjectMapper.ConvertOrder(row)); } return(orders); }
public async Task <IList <OrderPosition> > GetOrderPositionsByOrderId(Guid orderId) { DataSet dataSet = await _storedProceduresExecutor.ExecuteQuery( StoredProceduresNames.GetOrderPositionsByOrderId, new List <SqlParameter>(1) { new SqlParameter("@orderId", orderId) }); IList <OrderPosition> orderPositions = new List <OrderPosition>(); foreach (DataRow row in dataSet.Tables[0].Rows) { orderPositions.Add(_dataRowToObjectMapper.ConvertOrderPosition(row)); } return(orderPositions); }
public async Task <Restaurant> CreateRestaurant(string name, string phoneNumber, bool isPyszne, decimal?minOrderCost, decimal?deliveryCost, decimal?maxPaidOrderValue) { IList <SqlParameter> parameters = new List <SqlParameter> { new SqlParameter("@Name", name), new SqlParameter("@PhoneNumber", phoneNumber), new SqlParameter("@IsPyszne", isPyszne), new SqlParameter("@MinOrderCost", minOrderCost ?? (object)DBNull.Value), new SqlParameter("@DeliveryCost", deliveryCost ?? (object)DBNull.Value), new SqlParameter("@MaxPaidOrderValue", maxPaidOrderValue ?? (object)DBNull.Value) }; DataSet ds = await _storedProceduresExecutor.ExecuteQuery(StoredProceduresNames.CreateRestaurant, parameters); return(ReadFromDataSet(ds)); }