static void Main() { var db = new RecipesDBContext(); db.Database.EnsureDeleted(); db.Database.EnsureCreated(); db.Recipes.Add(new Recipe { Name = "Musaka", Description = "Traditional bulgarian meal", CookingTime = new TimeSpan(2, 3, 4) }); db.SaveChanges(); }
public IActionResult AddToFavorites(string Title, string Href, string Ingredients, string Thumbnail) { var dbModel = new RecipeFavoritesDAL(); dbModel.Title = Title; dbModel.Href = Href; dbModel.Ingredients = Ingredients; dbModel.Thumbnail = Thumbnail; dbModel.UserId = _userManager.GetUserId(User); _recipesDbContext.FavoriteRecipes.Add(dbModel); _recipesDbContext.SaveChanges(); return(View()); }