Beispiel #1
0
        public ActionResult RemoveRecipeFromCalendar(int dayOfWeek, int type)
        {
            RecipeCalendarData calendarData = db.RecipeCalendar.Find(User.Identity.Name, dayOfWeek, type);

            db.RecipeCalendar.Remove(calendarData);
            db.SaveChanges();
            return(RedirectToAction("Index", new { id = _recipeName }));
        }
Beispiel #2
0
        public ActionResult SaveRecipeToCalendar(int dayOfWeek, int type)
        {
            RecipeCalendarData calendarData = new RecipeCalendarData();

            calendarData.UserName     = User.Identity.Name;
            calendarData.DayOfTheWeek = dayOfWeek;
            calendarData.TypeOfMeal   = type;
            calendarData.RecipeName   = _recipeName;
            db.RecipeCalendar.AddOrUpdate(calendarData);
            db.SaveChanges();
            return(RedirectToAction("Index", new { id = _recipeName }));
        }