public async Task <IActionResult> PutBåtHusetBokningTransaction(int id, BåtHusetBokningTransaction båtHusetBokningTransaction)
        {
            if (id != båtHusetBokningTransaction.BåtHusetBokningTransactionID)
            {
                return(BadRequest());
            }

            _context.Entry(båtHusetBokningTransaction).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BåtHusetBokningTransactionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> OnPost()
        {
            if (!ModelState.IsValid)
            {
                båtHusetBokningSummary = await apiHelper.GetCallApiAsync <BåtHusetBokningTransaction>(GlobalValue.ApiPath + "/BåtHusetBokningTransaction/" + båtHusetBokningSummary.BåtHusetBokningTransactionID);

                return(Page());
            }

            return(RedirectToPage("/BåthusetResa/PaymentSummary", new { id = båtHusetBokningSummary.BåtHusetBokningTransactionID }));
        }
        public async Task OnGet(int?id)
        {
            //Submit = new List<int>();

            båtHusetBokningSummary = new List <BåtHusetBokningTransaction>();
            booking = new BåtHusetBokningTransaction();
            //båtHusetBokningSummary = await apiHelper.GetCallApiAsync<IList<BåtHusetBokningTransaction>>(GlobalValue.ApiPath + "/BåtHusetBokningTransaction/"+id);
            booking = await apiHelper.GetCallApiAsync <BåtHusetBokningTransaction>(GlobalValue.ApiPath + "/BåtHusetBokningTransaction/" + id);

            //RedirectToPage("/BåthusetResa/payment", new { id = booking.BåtHusetBokningTransactionID });
        }
Exemple #4
0
        public async Task OnGet(int id)

        {
            båtHusetBokningSummary = await apiHelper.GetCallApiAsync <BåtHusetBokningTransaction>(GlobalValue.ApiPath + "/BåtHusetBokningTransaction/" + id);
        }
        //båtHusetBokningTransaction = new BåtHusetBokningTransaction();
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            //decimal price = 0;
            string  otherActivities = string.Empty;
            decimal priceOfActivity = 0;

            foreach (var item in areChecked)
            {
                //item.value = "Barn ACtivities";
                if (!string.IsNullOrEmpty(otherActivities))
                {
                    otherActivities += ",";
                }

                otherActivities += item;
                String[] result = Regex.Split(otherActivities, " ");
                int      length = result.Count();
                priceOfActivity += Convert.ToDecimal(result[length - 1]);
            }

            ////andraaktiviteter.Where(p=>p.ActivityName.Contains(item));
            // var found = båtHusetBokning.Where(p => p.OtherActivities == otherActivities).Single();
            //if(found.PriceOfTicket.Equals(1000) ||found.PriceOfTicket.Equals(450))
            // {
            //     Console.WriteLine(found);
            // }
            ////var result= andraaktiviteter.Where(p =>p.ActivityName.Contains());
            //}
            //decimal price =0;
            //string otherActivities = string.Empty
            //foreach(var item in areChecked)
            //{
            //    //item.value = "Barn ACtivities";
            //    if (!string.IsNullOrEmpty(otherActivities))
            //        otherActivities += ",";

            //    otherActivities += item;
            //    //price += båtHusetBokning[0].PriceOfTicket;
            //}

            string  restaurant        = string.Empty;
            decimal priceOfRestaurant = 0;

            foreach (var item1 in lstRestaurant)
            {
                //item.value = "Barn ACtivities";
                if (!string.IsNullOrEmpty(restaurant))
                {
                    restaurant += ",";
                }

                restaurant += item1;
                String[] result = Regex.Split(restaurant, " ");
                int      length = result.Count();
                priceOfRestaurant += Convert.ToDecimal(result[length - 1]);
                //    return totalPrice1.ToString();
            }
            string beverages = string.Empty;

            foreach (var item1 in lstBeverages)
            {
                //item.value = "Barn ACtivities";
                if (!string.IsNullOrEmpty(beverages))
                {
                    beverages += ",";
                }

                beverages += item1;
            }

            båtHusetBokningTransaction = BindData(otherActivities, restaurant, beverages);
            TotalPrice = ((350 + priceOfActivity + priceOfRestaurant) * NoOfPersons);
            var userId = HttpContext.Session.GetString("Id");

            båtHusetBokningTransaction.UserId     = Convert.ToInt32(userId);
            båtHusetBokningTransaction.TotalPrice = TotalPrice;
            //båtHusetBokningTransaction.UserId = userDetails.Id;
            //{
            //
            //}
            //if (userDetails.EmailId == "*****@*****.**" && userDetails.Password == "indira)
            ////string Message;
            var booking = await apiHelper.PostCallApiAsync <BåtHusetBokningTransaction>(GlobalValue.ApiPath + "/BåtHusetBokningTransaction", båtHusetBokningTransaction);

            //return RedirectToPage("/BåthusetResa/payment", new { id = booking.BåtHusetBokningTransactionID });
            return(RedirectToPage("./BåtHusetbokningSummary", new { id = booking.BåtHusetBokningTransactionID }));
            //HttpContext.Session.SetString("Name", userDetails.UserName);
            //HttpContext.Session.SetString("Role", userDetails.UserType);
            //return RedirectToPage("./BåtHusetBokning");
        }
        public async Task <ActionResult <BåtHusetBokningTransaction> > PostBåtHusetBokningTransaction(BåtHusetBokningTransaction båtHusetBokningTransaction)
        {
            _context.BåtHusetBokningTransaction.Add(båtHusetBokningTransaction);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBåtHusetBokningTransaction", new { id = båtHusetBokningTransaction.BåtHusetBokningTransactionID }, båtHusetBokningTransaction));
        }