public async Task <IActionResult> Create([Bind("Id,Name,MenuId")] MenuCategory menuCategory)
        {
            menuCategory.Id = 0;//För att fixa autoincrement som blir inte automatiskt blir 0
            await RestHelper.ApiCreate <MenuCategory>(menuCatApi, menuCategory);

            return(RedirectToAction("Index", "Menus"));
        }
        public async Task <ActionResult> CreateActivityBooking(string name, int num, int aId)
        {
            System.Diagnostics.Debug.WriteLine("<-- CreateActivityBooking -->");
            System.Diagnostics.Debug.WriteLine("name: " + name);
            System.Diagnostics.Debug.WriteLine("num: " + num);
            System.Diagnostics.Debug.WriteLine("aId: " + aId);



            var newAB = new ActivityBooking();

            newAB.CustomerName    = name;
            newAB.NumParticipants = num;
            newAB.ActivityId      = aId;
            var response = "<-- CreateActivityBooking was called -->";


            /// Fungerar, MEN måste fixa så att när den får null att det inte crashar.
            // var s = RestHelper.PrintObjProps<ActivityBooking>(newAB);
            // System.Diagnostics.Debug.WriteLine($"<-- {s} -->");

            await RestHelper.ApiCreate <ActivityBooking>("ActivityBookings/", newAB);


            return(Json(response));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Description,Allergies,Price,MenuCategoryId")] MenuItems menuItems)
        {
            menuItems.Id = 0;
            await RestHelper.ApiCreate <MenuItems>(menuItemApi, menuItems);

            return(RedirectToAction("Index", "Menus" /*, new { id = menuItems.MenuCategoryId }*/));
        }
 public async Task <IActionResult> Create([Bind("Id,StartTime,EndTime,CustomerName,NumParticipants,TableNum")] Reservation reservation)
 {
     try
     {
         await RestHelper.ApiCreate <Reservation>(api, reservation);
     }
     catch (Exception e)
     {
         logger.LogError("Error trying to create new reservation \n" + e);
         throw;
     }
     //När användaren har skapat en reservation så kommer de att tas till respektive hemsida baserat på om de är inloggade som admin eller inte
     if (User.Identity.IsAuthenticated)
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(Redirect("~/Home/Index/"));
     }
 }
Exemple #5
0
        public async Task <IActionResult> Create([Bind("Id,CustomerName,NumParticipants,ActivityId")] ActivityBooking activityBooking)
        {
            await RestHelper.ApiCreate <ActivityBooking>(api, activityBooking);

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Create([Bind("Id,DayName,Open,Closed")] RestaurantInfo restaurantInfo)
        {
            await RestHelper.ApiCreate <RestaurantInfo>(api, restaurantInfo);

            return(RedirectToAction("Index"));
        }
Exemple #7
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Menu menu)
        {
            await RestHelper.ApiCreate <Menu>(menuApi, menu);

            return(RedirectToAction("Index"));
        }
        public async Task <IActionResult> Create([Bind("Id,Description,Location,Price,StartTime,EndTime")] Activity activity)
        {
            await RestHelper.ApiCreate <Activity>(api, activity);

            return(RedirectToAction("Index"));
        }