public void AddHasEaten(HasEaten has) { DBController dbc = new DBController(); try { dbc.AddHasEaten(has); } catch (NpgsqlException e) { Console.WriteLine((Program.sqlDebugMessages) ? "AddHasEaten: " + e.BaseMessage.ToString() : ""); WebOperationContext ctx = WebOperationContext.Current; ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Conflict; ctx.OutgoingResponse.StatusDescription = e.BaseMessage; } finally { dbc.Close(); } }
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(); }