/// <summary> /// Method will take a list of the user's meal name for a day and size and put /// the information into the database, and then cycle through the list of /// recipe names and add them to the the meal in the appropriate table. If /// the recipe exists with the meal and was included, it will stay with the meal. /// If a recipe is not included with a meal, then it should be removed, if in table. /// </summary> /// <param name="user">Name of user creating meal</param> /// <param name="date"> Date for meal to be created with (YYYY-MM-DD)</param> /// <param name="mealName">Name of meal to be created or updated</param> /// <param name="size">Number of people being served</param> /// <param name="recipeNames">List of recipes that should be in the database. /// <strong>NOTE</strong>: Be careful of spaces between recipes</param> /// <example> /CalendarScreen/MealNameExisting?user=tester&date=2015-11-01& /// mealName=LastMinuteResort&size=5&recipeNames=Italian%20Pasta,Caesar%20Salad </example> /// <example> /CalendarScreen/MealNameExisting?user=tester&date=2015-11-01& /// mealName=LastMinuteResort&size=5&recipeNames=Budo Budo </example> /// <returns></returns> public ActionResult MealNameExisting(string user, string date, string mealName, int size, string recipeNames) { if (user == null || date == null || mealName == null ){ return Json(null, JsonRequestBehavior.AllowGet); } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); int? returnValue = -1; int result = scdc.MealNameExists(user, date, mealName, size, ref returnValue); // Removes all values for the associated mealId int removeResult = scdc.RemoveRecipesFromMealId(returnValue.Value); // Debugging purposes // System.Diagnostics.Debug.WriteLine(recipeNames); if (recipeNames != null) { // Only time PutRecipeWithMeal should be called string[] list = recipeNames.Split(','); foreach (string keyword in list) { System.Diagnostics.Debug.WriteLine(keyword); int temp = PutRecipesWithMeal(returnValue.Value, keyword); if (temp == -1) { // Debugging purposes //System.Diagnostics.Debug.WriteLine("Oh god no"); } } } return Json(returnValue, JsonRequestBehavior.AllowGet); }
/// <summary> /// Method will take a list of the user's meal name for a day and size and put /// the information into the database, and then cycle through the list of /// recipe names and add them to the the meal in the appropriate table. If /// the recipe exists with the meal and was included, it will stay with the meal. /// If a recipe is not included with a meal, then it should be removed, if in table. /// </summary> /// <param name="user">Name of user creating meal</param> /// <param name="date"> Date for meal to be created with (YYYY-MM-DD)</param> /// <param name="mealName">Name of meal to be created or updated</param> /// <param name="size">Number of people being served</param> /// <param name="recipeNames">List of recipes that should be in the database. /// <strong>NOTE</strong>: Be careful of spaces between recipes</param> /// <example> /CalendarScreen/MealNameExisting?user=tester&date=2015-11-01& /// mealName=LastMinuteResort&size=5&recipeNames=Italian%20Pasta,Caesar%20Salad </example> /// <example> /CalendarScreen/MealNameExisting?user=tester&date=2015-11-01& /// mealName=LastMinuteResort&size=5&recipeNames=Budo Budo </example> /// <returns></returns> public ActionResult MealNameExisting(string user, string date, string mealName, int size, string recipeNames) { if (user == null || date == null || mealName == null) { return(Json(null, JsonRequestBehavior.AllowGet)); } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); int?returnValue = -1; int result = scdc.MealNameExists(user, date, mealName, size, ref returnValue); // Removes all values for the associated mealId int removeResult = scdc.RemoveRecipesFromMealId(returnValue.Value); // Debugging purposes // System.Diagnostics.Debug.WriteLine(recipeNames); if (recipeNames != null) { // Only time PutRecipeWithMeal should be called string[] list = recipeNames.Split(','); foreach (string keyword in list) { System.Diagnostics.Debug.WriteLine(keyword); int temp = PutRecipesWithMeal(returnValue.Value, keyword); if (temp == -1) { // Debugging purposes //System.Diagnostics.Debug.WriteLine("Oh god no"); } } } return(Json(returnValue, JsonRequestBehavior.AllowGet)); }
public ActionResult Search(string inputKeywords, string ordertype, string ascending) { string[] keywordList = inputKeywords.Split(','); //At least one letter must be submitted to begin searching Regex rx = new Regex("^[A-Za-z,]+$"); // Find matches. Match matched = rx.Match(inputKeywords); System.Diagnostics.Debug.WriteLine(matched.ToString()); if (!matched.Success) { return(Json(new List <SearchSingleKeywordResult>(), JsonRequestBehavior.AllowGet)); } else { Dictionary <string, List <SearchSingleKeywordResult> > resultListDict = new Dictionary <string, List <SearchSingleKeywordResult> >(); SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable <SearchSingleKeywordResult> tempRes = null; foreach (string keyword in keywordList) { List <SearchSingleKeywordResult> newRes = scdc.SearchSingleKeyword(keyword, ordertype, ascending).ToList(); if (tempRes == null) { tempRes = newRes.ToList(); } else { tempRes = tempRes.Intersect(newRes.ToList(), new SearchSingleComparer()); } } return(Json(tempRes, JsonRequestBehavior.AllowGet)); } }
public JsonResult getUserProperties(string user) { JsonResult json = new JsonResult(); Models.Member member = new Models.Member(); SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); member.memname = SCDC.Members.Where(m => m.Memname == user).Select(m => m.Memname).First(); member.allergens = new List <Allergen>(); foreach (var allergen in SCDC.Member_Allergens.Where(m => m.Memname == member.memname)) { FoodItem item = new FoodItem { FoodName = allergen.Foodname }; member.allergens.Add(new Allergen { FoodItem = item }); } member.groups = new List <Models.Member_Group>(); foreach (var group in SCDC.Member_Groups.Where(m => m.Groupadmin == member.memname)) { member.groups.Add(new Models.Member_Group { Name = group.Groupname, adminName = member.memname }); } json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; json.Data = member; return(json); }
public JsonResult getAllAllergens() { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); json.Data = SCDC.GET_Allergens().ToList(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return json; }
public JsonResult getGroups(string user, string pass) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); json.Data = SCDC.Get_Groups(user, pass).ToList(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return json; }
//GET: /RecipeTasks/ /// <summary> /// /// </summary> /// <param name="recid"></param> /// <returns></returns> public ActionResult RecipeTasks(int recid) { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable <RecipeTasksResult> recipeTasks = null; recipeTasks = scdc.RecipeTasks(recid); return(Json(recipeTasks, JsonRequestBehavior.AllowGet)); }
/// <summary> /// /// </summary> /// <param name="mealid"></param> /// <returns></returns> public ActionResult Index(int mealid) { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable<TasksForMealResult> mealTasks = null; mealTasks = scdc.TasksForMeal(mealid); return Json(mealTasks, JsonRequestBehavior.AllowGet); }
/// <summary> /// /// </summary> /// <param name="mealid"></param> /// <returns></returns> public ActionResult Index(int mealid) { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable <TasksForMealResult> mealTasks = null; mealTasks = scdc.TasksForMeal(mealid); return(Json(mealTasks, JsonRequestBehavior.AllowGet)); }
//GET: /RecipeTasks/ /// <summary> /// /// </summary> /// <param name="recid"></param> /// <returns></returns> public ActionResult RecipeTasks(int recid) { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable<RecipeTasksResult> recipeTasks = null; recipeTasks = scdc.RecipeTasks(recid); return Json(recipeTasks, JsonRequestBehavior.AllowGet); }
public JsonResult getApplianceInfo(string user, string password) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); json.Data = SCDC.GET_ApplianceInfo(user, password).ToList(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return json; }
public JsonResult getApplianceInfo(string user, string password) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); json.Data = SCDC.GET_ApplianceInfo(user, password).ToList(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(json); }
public JsonResult getGroups(string user, string pass) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); json.Data = SCDC.Get_Groups(user, pass).ToList(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(json); }
public JsonResult addAllergen(string user, string password, string allergen) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); SCDC.ADD_Allergy_User(user, password, allergen); json.Data = true; json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return json; }
public JsonResult getAllAllergens() { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); json.Data = SCDC.GET_Allergens().ToList(); json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(json); }
public JsonResult getAllergens(string user, string password) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var allergens = SCDC.GET_Allergens_User(user, password).ToList(); var json = new JsonResult(); json.Data = allergens; json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return json; }
public JsonResult addAllergen(string user, string password, string allergen) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); SCDC.ADD_Allergy_User(user, password, allergen); json.Data = true; json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(json); }
public JsonResult getAllergens(string user, string password) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var allergens = SCDC.GET_Allergens_User(user, password).ToList(); var json = new JsonResult(); json.Data = allergens; json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(json); }
/// <summary> /// Add meal to database /// </summary> /// <param name="user">username</param> /// <param name="mealname">meal name</param> /// <param name="date">date</param> /// <param name="size">size of meal</param> /// <returns>Meal id</returns> /// <example>/CalendarScreen/AddMeal?user=tester&mealname=hello&date=2015-11-05&size=5</example> public ActionResult AddMeal(string user, string mealname, string date, int size) { if (user == null || mealname == null || date == null) { return(Json(null, JsonRequestBehavior.AllowGet)); } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); return(Json(scdc.AddMeal(user, mealname, date, size), JsonRequestBehavior.AllowGet)); }
/// <summary> /// Removes a meal from the agenda. Will remove dependencies /// from other tables. Is not implemented to handle bookmarked dates, /// but neither is the UI at the moment of this creation. /// </summary> /// <param name="user">Username for agenda</param> /// <param name="mealid">Meal id to remove</param> /// <example>/CalendarScreen/RemoveMealFromTables?user=tester&mealid=100</example> public void RemoveMealFromTables(string user, int mealid) { if (user == null) { return; } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); scdc.RemoveMealFromTables(user, mealid); return; }
/// <summary> /// Removes a meal from a certain day of the agenda. /// </summary> /// <param name="user">User removing meal</param> /// <param name="mealName">Name of meal</param> /// <param name="date">Date of meal</param> /// <returns>Action result that is an integer, value should not normally matter</returns> public ActionResult RemoveMeal(string user, string mealName, string date) { if (user == null || mealName == null || date == null) { return(Json(null, JsonRequestBehavior.AllowGet)); } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); int result = scdc.RemoveMeal(mealName, date, user); return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Used to add recipe id to meal id in Meal_Recipes table. /// Can be called in a loop to handle a list of recipes since /// It would be hard to make an array datatype for the database. /// It is should only be called <strong>AFTER</strong> /// <i>MealNameExists</i> because a valid mealId will be passed back. /// </summary> /// <param name="mealId"> Integer that is a valid meal</param> /// <param name="recipeName"> Name of recipe, which is assumed ot be valid since /// this is only called after MealNameExists</param> /// /// <returns>An integer from the query execution, the Mealid having operations done with</returns> private int PutRecipesWithMeal(int mealId, string recipeName) { if (recipeName == null) { return(-1); } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); int result; result = scdc.AddRecipeToMeal(mealId, recipeName); return(result); }
/// <summary> /// Used to get recipes for a meal to be displayed. /// </summary> /// <param name="user">Current user to get recipes for a meal</param> /// <param name="mealId">Meal id to find associated recipes</param> /// <returns></returns> public ActionResult GetRecipesForMeal(string user, int mealId) { if (user == null) { return(Json(null, JsonRequestBehavior.AllowGet)); } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable <RecipesForMealResult> rfmr = null; rfmr = scdc.RecipesForMeal(user, mealId); return(Json(rfmr, JsonRequestBehavior.AllowGet)); }
public ActionResult SearchByUnion(string inputKeywords, string ordertype, string ascending, string subgenre) { Dictionary <string, List <SearchSingleKeywordResult> > resultListDict = new Dictionary <string, List <SearchSingleKeywordResult> >(); Dictionary <string, List <SearchSingleKeywordResult> > resultSubgenreDict = new Dictionary <string, List <SearchSingleKeywordResult> >(); IEnumerable <SearchSingleKeywordResult> subgenreList = null; IEnumerable <SearchSingleKeywordResult> helperList = null; string[] keywordList = inputKeywords.Split(','); string[] subgenreKeywords = subgenre.Split(','); Regex rx = new Regex("^[A-Za-z,]+$"); // Find matches. Match matched = rx.Match(subgenre); System.Diagnostics.Debug.WriteLine(matched.Value.ToString()); if (!matched.Success) { return(Json(new List <SearchSingleKeywordResult>(), JsonRequestBehavior.AllowGet)); } else { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); foreach (string subgenreKeyword in subgenreKeywords) { if (helperList == null) { subgenreList = new List <SearchSingleKeywordResult>(scdc.SearchSingleKeyword(subgenreKeyword, ordertype, ascending)); helperList = new List <SearchSingleKeywordResult>(scdc.SearchSingleKeyword(subgenreKeyword, ordertype, ascending)); } resultSubgenreDict[subgenreKeyword] = new List <SearchSingleKeywordResult>(scdc.SearchSingleKeyword(subgenreKeyword, ordertype, ascending)); } foreach (string subgenreKey in resultSubgenreDict.Keys) { subgenreList = subgenreList.Intersect(resultSubgenreDict[subgenreKey], new SearchSingleComparer()); helperList = subgenreList.Intersect(resultSubgenreDict[subgenreKey], new SearchSingleComparer()); } foreach (string keyword in keywordList) { if (subgenreList == null) { subgenreList = new List <SearchSingleKeywordResult>(scdc.SearchSingleKeyword(keyword, ordertype, ascending)); } resultListDict[keyword] = new List <SearchSingleKeywordResult>(scdc.SearchSingleKeyword(keyword, ordertype, ascending)); } foreach (string currKey in resultListDict.Keys) { subgenreList = subgenreList.Intersect(resultListDict[currKey], new SearchSingleComparer()); helperList = helperList.Except(resultListDict[currKey], new SearchSingleComparer()); } return(Json(subgenreList.Concat(helperList), JsonRequestBehavior.AllowGet)); } }
public ActionResult GenerateUpcomingMeals(string user, string date1, string date2) { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); List <string> stringList = new List <string>(); IEnumerable <GetMealsBetweenDatesResult> mealList = scdc.GetMealsBetweenDates(user, date1, date2); foreach (GetMealsBetweenDatesResult meal in mealList) { string newString = meal.Mealday.Value.Date.ToShortDateString() + ";" + meal.Mealname.ToString() + ";" + meal.Mealsize.ToString(); stringList.Add(newString); } return(Json(stringList, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Used to call the stored procedure GetMealForDay /// </summary> /// <param name="user">Current user to get meals for</param> /// <param name="date">String format of day (YYYY-MM-DD)</param> /// /// <example> /CalendarScreen/GetMealDay?user=tester&date=2015-10-30 </example> /// <returns>JSON object that passes back information that can be used /// to generate objects in the UI</returns> public ActionResult GetMealDay(string user, string date) { if (user == null || date == null) { return Json(null, JsonRequestBehavior.AllowGet); } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable<GetMealForDayResult> gmfdr = null; // Debugging purposes //System.Diagnostics.Debug.WriteLine(date); gmfdr = scdc.GetMealForDay(user, date); return Json(gmfdr, JsonRequestBehavior.AllowGet); }
/// <summary> /// Used to call the stored procedure GetMealForDay /// </summary> /// <param name="user">Current user to get meals for</param> /// <param name="date">String format of day (YYYY-MM-DD)</param> /// /// <example> /CalendarScreen/GetMealDay?user=tester&date=2015-10-30 </example> /// <returns>JSON object that passes back information that can be used /// to generate objects in the UI</returns> public ActionResult GetMealDay(string user, string date) { if (user == null || date == null) { return(Json(null, JsonRequestBehavior.AllowGet)); } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable <GetMealForDayResult> gmfdr = null; // Debugging purposes //System.Diagnostics.Debug.WriteLine(date); gmfdr = scdc.GetMealForDay(user, date); return(Json(gmfdr, JsonRequestBehavior.AllowGet)); }
public JsonResult setBurnerInfo(string user, string password, string toolId, string pwrType, string number) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); try { SCDC.SET_StoveInfo(user, password, Convert.ToInt32(toolId), Convert.ToInt32(number), pwrType); json.Data = true; } catch { json.Data = false; } json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(json); }
//GET: /RecipeIngredients/ /// <summary> /// /// </summary> /// <param name="recid"></param> /// <returns></returns> public ActionResult RecipeIngredients(int recid) { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable<RecipeIngredientsResult> recipeIngredients = null; recipeIngredients = scdc.RecipeIngredients(recid); return Json(recipeIngredients, JsonRequestBehavior.AllowGet); /* Food_Item[] tempResult = new Food_Item[4]; tempResult[0] = new Food_Item(); tempResult[0].Foodname = "2 small garlic cloves"; tempResult[1] = new Food_Item(); tempResult[1].Foodname = "2 sticks unsalted butter"; tempResult[2] = new Food_Item(); tempResult[2].Foodname = "1 1/2 teaspoons finely chopped flat-leaf parsley"; tempResult[3] = new Food_Item(); tempResult[3].Foodname = "2 (1 1/4-pound) live lobsters"; return Json(tempResult, JsonRequestBehavior.AllowGet); */ }
//GET: /RecipeIngredients/ /// <summary> /// /// </summary> /// <param name="recid"></param> /// <returns></returns> public ActionResult RecipeIngredients(int recid) { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); IEnumerable <RecipeIngredientsResult> recipeIngredients = null; recipeIngredients = scdc.RecipeIngredients(recid); return(Json(recipeIngredients, JsonRequestBehavior.AllowGet)); /* Food_Item[] tempResult = new Food_Item[4]; * tempResult[0] = new Food_Item(); * tempResult[0].Foodname = "2 small garlic cloves"; * tempResult[1] = new Food_Item(); * tempResult[1].Foodname = "2 sticks unsalted butter"; * tempResult[2] = new Food_Item(); * tempResult[2].Foodname = "1 1/2 teaspoons finely chopped flat-leaf parsley"; * tempResult[3] = new Food_Item(); * tempResult[3].Foodname = "2 (1 1/4-pound) live lobsters"; * return Json(tempResult, JsonRequestBehavior.AllowGet); */ }
public JsonResult getUserProperties(string user) { JsonResult json = new JsonResult(); Models.Member member = new Models.Member(); SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); member.memname = SCDC.Members.Where(m => m.Memname == user).Select(m => m.Memname).First(); member.allergens = new List<Allergen>(); foreach (var allergen in SCDC.Member_Allergens.Where(m => m.Memname == member.memname)) { FoodItem item = new FoodItem { FoodName = allergen.Foodname }; member.allergens.Add(new Allergen { FoodItem = item }); } member.groups = new List<Models.Member_Group>(); foreach (var group in SCDC.Member_Groups.Where(m => m.Groupadmin == member.memname)) { member.groups.Add(new Models.Member_Group { Name = group.Groupname, adminName = member.memname }); } json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; json.Data = member; return json; }
/// <summary> /// Used to add recipe id to meal id in Meal_Recipes table. /// Can be called in a loop to handle a list of recipes since /// It would be hard to make an array datatype for the database. /// It is should only be called <strong>AFTER</strong> /// <i>MealNameExists</i> because a valid mealId will be passed back. /// </summary> /// <param name="mealId"> Integer that is a valid meal</param> /// <param name="recipeName"> Name of recipe, which is assumed ot be valid since /// this is only called after MealNameExists</param> /// /// <returns>An integer from the query execution, the Mealid having operations done with</returns> private int PutRecipesWithMeal(int mealId, string recipeName) { if (recipeName == null) { return -1; } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); int result; result = scdc.AddRecipeToMeal(mealId, recipeName); return result; }
// GET: /dbtest/ public ActionResult dbtest() { SpeedyChefDataContext context = new SpeedyChefDataContext(); string temp = context.Members.Select(m=>m.Memname).First(); return Json(temp, JsonRequestBehavior.AllowGet); }
/// <summary> /// Adds recipes to meal /// </summary> /// <param name="mealid"> Meal id</param> /// <param name="recid">Recipe id</param> /// <example>/CalendarScreen/AddRecipeForMeal?mealid=2&recid=6</example> public void AddRecipeForMeal(int mealid, int recid) { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); scdc.AddRecipe(mealid, recid); }
/// <summary> /// Returns infomation about given recipe for id /// </summary> /// <param name="recid">Recipe id</param> /// <returns>Json about recipe</returns> /// <example>/CalendarScreen/GetRecipe?recid=2</example> public ActionResult GetRecipe(int recid) { SpeedyChefDataContext sdcd = new SpeedyChefDataContext(); return(Json(sdcd.RecipeInfo(recid), JsonRequestBehavior.AllowGet)); }
/// <summary> /// Inserts recipe with meal /// </summary> /// <param name="mealId">Meal id to add recipe with</param> /// <param name="recId">Recipe id to add meal to</param> /// <example>/CalendarScreen/InsertRecForMeal?mealId=13&recId=2</example> public void InsertRecForMeal(int mealId, int recId) { SpeedyChefDataContext scdc = new SpeedyChefDataContext(); scdc.InsertRecipeForMeal(mealId, recId); }
public JsonResult setBurnerInfo(string user, string password, string toolId, string pwrType, string number) { SpeedyChefDataContext SCDC = new SpeedyChefDataContext(); var json = new JsonResult(); try { SCDC.SET_StoveInfo(user, password, Convert.ToInt32(toolId), Convert.ToInt32(number), pwrType); json.Data = true; } catch { json.Data = false; } json.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return json; }
/// <summary> /// Removes a meal from a certain day of the agenda. /// </summary> /// <param name="user">User removing meal</param> /// <param name="mealName">Name of meal</param> /// <param name="date">Date of meal</param> /// <returns>Action result that is an integer, value should not normally matter</returns> public ActionResult RemoveMeal(string user, string mealName, string date) { if (user == null || mealName == null || date == null) { return Json(null, JsonRequestBehavior.AllowGet); } SpeedyChefDataContext scdc = new SpeedyChefDataContext(); int result = scdc.RemoveMeal(mealName, date, user); return Json(result, JsonRequestBehavior.AllowGet); }