public JsonResult GetRecipe(string tableName) { var table = WaiterManager.GetTable(tableName); var json = JsonConvert.SerializeObject(table); return(Json(json)); }
public JsonResult GetDishesByTable(string tableName) { var table = WaiterManager.GetTable(tableName); if (table == null) { return(Json(new { text = "error" })); } var json = JsonConvert.SerializeObject(table.OrderedDishes); return(Json(new { text = "success", json })); }
public JsonResult DeleteDishByTable(string tableName, string dishName) { var table = WaiterManager.GetTable(tableName); if (table == null) { return(Json(new { text = "error" })); } table.RemoveDish(dishName); var isTableInOrders = WaiterManager.CheckTableInOrders(table); return(Json(new { text = "success", isTableInOrders, totalPrice = table.TotalPrice })); }
public JsonResult ChangeDishToTable(string tableName, string dishName, int amount) { var table = WaiterManager.GetTable(tableName); if (table == null) { return(Json(new { isTableInOrders = false, totalPrice = 0 })); } var isTableInOrders = WaiterManager.CheckTableInOrders(table); WaiterManager.ChangeDishToTable(tableName, dishName, amount); double totalPrice = table.TotalPrice; return(Json(new { isTableInOrders, totalPrice })); }
public JsonResult LoadRestaurationData(int tableAmount) { WaiterManager.LoadData(tableAmount); return(Json(new { text = "loaded " + tableAmount })); }
public JsonResult DeleteOrder(string tableName) { WaiterManager.RemoveOrder(tableName); return(Json(new { text = "success", isTableInOrders = false })); }