Пример #1
0
        public void AddFavorises(Favorises fav)
        {
            DBController dbc = new DBController();

            try {
                dbc.AddFavorises(fav);
            } catch (NpgsqlException e) {
                Console.WriteLine((Program.sqlDebugMessages) ? "AddFavorises: " + e.BaseMessage.ToString() : "");
                WebOperationContext ctx = WebOperationContext.Current;
                ctx.OutgoingResponse.StatusCode        = System.Net.HttpStatusCode.Conflict;
                ctx.OutgoingResponse.StatusDescription = e.BaseMessage;
            } finally {
                dbc.Close();
            }
        }
Пример #2
0
        public static void dbMassInsert()
        {
            DBController dbc = new DBController();

            dbc.AddAccount(ModelDebug.GetTestAccount());
            dbc.AddIngredient(ModelDebug.GetTestIngredient());
            dbc.AddRetailer(ModelDebug.GetTestRetailer());
            dbc.AddRecipe(ModelDebug.GetTestRecipe());
            dbc.AddComment(ModelDebug.GetTestComment());

            dbc.AddFavorises(ModelDebug.GetTestFavorises());
            dbc.AddHasEaten(ModelDebug.GetTestHasEaten());
            dbc.AddIngredientIn(ModelDebug.GetTestIngredientIn());
            dbc.AddOffers(ModelDebug.GetTestOffers());
            dbc.AddPictures(ModelDebug.GetTestPictures());

            dbc.Close();
        }