public void Add(IRestaurantModel restaurantModel) { //throw new NotImplementedException(); DataAccessStatus dataAccesStatus = new DataAccessStatus(); using (SQLiteConnection sqLiteConnection = new SQLiteConnection(_connectionString)) { try { sqLiteConnection.Open(); } catch (SQLiteException e) { dataAccesStatus.setValues(status: "Error", operationSucceded: false, exceptionMessage: e.Message, customMessage: "Unable to open db connection", helpLink: e.HelpLink, errorCode: e.ErrorCode, stackTrace: e.StackTrace); throw new DataAccessException(e.Message, e.InnerException, dataAccesStatus); } string sql = "INSERT INTO Restaurants (RestaurantAddress, RestaurantName)" + "VALUES (@RestaurantAddress, @RestaurantName)"; using (SQLiteCommand cmd = new SQLiteCommand(sql, sqLiteConnection)) { /*try * { * UserExistsCheck(cmd, userModel, TypeOfExsistenceCheck.DoesNotExistInDB, RequestType.Add) * }*/ cmd.CommandText = sql; cmd.Prepare(); cmd.Parameters.AddWithValue("@RestaurantAddress", restaurantModel.RestaurantAddress); cmd.Parameters.AddWithValue("@RestaurantName", restaurantModel.RestaurantName); try { cmd.ExecuteNonQuery(); } catch (SQLiteException e) { dataAccesStatus.setValues(status: "Error", operationSucceded: false, exceptionMessage: e.Message, customMessage: "Unable to add Restaurant to db", helpLink: e.HelpLink, errorCode: e.ErrorCode, stackTrace: e.StackTrace); throw new DataAccessException(e.Message, e.InnerException, dataAccesStatus); } sqLiteConnection.Close(); } } }
/// <summary> Ресторан с тремя звездами Мишлена </summary> public Michelins3StarsRestaurant(IWaiterFactory waiterFactory, IRestaurantModel restaurantModel) { _waiterFactory = waiterFactory; _restaurantModel = restaurantModel; }
public void Update(IRestaurantModel restaurantModel) { throw new NotImplementedException(); }
/// <summary> Подмостовный ресторан </summary> public UnderTheBridgeRestaurant(IWaiterFactory waiterFactory, IRestaurantModel restaurantModel) { _waiterFactory = waiterFactory; _restaurantModel = restaurantModel; }
public void ValidateModelDataAnnotations(IRestaurantModel restaurantModel) { _modelDataAnnotationCheck.ValidateModelDataAnnotations(restaurantModel); }
public void ValidateModel(IRestaurantModel restaurantModel) { //throw new NotImplementedException(); _modelDataAnnotationCheck.ValidateModelDataAnnotations(restaurantModel); }
public void Delete(IRestaurantModel restaurantModel) { //throw new NotImplementedException(); _restaurantRepository.Delete(restaurantModel); }