Ejemplo n.º 1
0
        public ActionResult Create(TicketViewModel tvm, int id, HttpPostedFileBase Image)
        {
            //Context ctx = new Context();
            //ctx.Ticket.Add(new  Ticket {
            //    IdEvent = tvm.IdEvent ,
            //    Prix = tvm.Prix ,

            //     });

            //ctx.SaveChanges();

            var fileName = Path.GetFileName(Image.FileName);
            var path     = Path.Combine(Server.MapPath("~/Content/Upload/"), fileName);

            Image.SaveAs(path);
            T.IdEvent = tvm.IdEvent = id;
            T.Logo    = Image.FileName;
            T.Prix    = tvm.Prix;



            it.Add(T);
            it.Commit();


            return(RedirectToAction("Details", new { id = T.IdTicket }));
        }
Ejemplo n.º 2
0
        public async Task <int> AddCliente(ClienteModel clienteViewmodels)
        {
            var addEntity = await _clienteRepository.Add(ClienteMapper.Map(clienteViewmodels));

            clienteViewmodels.ticket.CliId = addEntity;
            await _ticketService.Add(clienteViewmodels.ticket);

            return(addEntity);
        }
Ejemplo n.º 3
0
        public IActionResult Add(Ticket ticket) // client'dan,angular'dan,react'dan vs. gönderdiğin ürünü buraya koy.
        {
            var result = _ticketService.Add(ticket);

            if (result.Success)// işlem sonucu true ise
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Ejemplo n.º 4
0
        public IActionResult Post([FromBody] TicketDTO ticket)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var result = _service.Add(ticket);

            return(result == true?StatusCode(200) : StatusCode(500));
        }
Ejemplo n.º 5
0
 public IActionResult Post([FromBody] Tickets tickets)
 {
     try
     {
         return(Ok(_ticketService.Add(tickets).ToApiModel()));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("Post", ex.Message);
         return(BadRequest(ModelState));
     }
 }
Ejemplo n.º 6
0
        public ActionResult Create([FromJson] OrderViewModel orderViewModel)
        {
            ModelState.Clear();
            string currentUserId = User.Identity.GetUserId();
            var    currentSeance = _seanceService.ReadById(orderViewModel.SeanceId);

            var permittedUserSeats = (from seat in currentSeance.ReservedSeats
                                      where seat.ApplicationUserId == currentUserId &&
                                      seat.IsSold == false &&
                                      DateTime.Compare(DateTime.Now, seat.ReservationTime.AddMinutes(10)) < 0
                                      select seat).ToList();

            List <SeatViewModel> targetSeats = new List <SeatViewModel>();

            foreach (var seat in permittedUserSeats)
            {
                SeatViewModel seatModel = (from seatToBuy in orderViewModel.Seats
                                           where seatToBuy.ColumnNumber == seat.ColumnNumber &&
                                           seatToBuy.RowNumber == seat.RowNumber

                                           select seatToBuy).SingleOrDefault();
                if (seatModel != null)
                {
                    targetSeats.Add(seatModel);
                }
            }
            bool areAllSeatsAccepted = orderViewModel.Seats.Count() == targetSeats.Count();

            if (!areAllSeatsAccepted)
            {
                return(Json(Url.Action("TimeIsOut", "Home")));
            }
            foreach (var seat in targetSeats)
            {
                ReservedSeatDomainModel payedSeat = (from reservedSeat in currentSeance.ReservedSeats
                                                     where reservedSeat.RowNumber == seat.RowNumber &&
                                                     reservedSeat.ColumnNumber == seat.ColumnNumber
                                                     select reservedSeat).SingleOrDefault();

                TicketDomainModel ticket = new TicketDomainModel();
                ticket.SeatId            = seat.Id;
                ticket.ApplicationUserId = currentUserId;
                ticket.PaymentDate       = DateTime.Now;
                ticket.PaymentMethodId   = orderViewModel.PaymentMethodId;
                ticket.SeanceId          = orderViewModel.SeanceId;
                payedSeat.IsSold         = true;
                //_seanceService.Update(currentSeance);
                _ticketService.Add(ticket);
                payedSeat.Seance = null;
                _reservedSeatService.Update(payedSeat);
            }
            return(Json(Url.Action("Index", "Ticket")));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> BookTicket(string captcha)
        {
            if (!await _captchaValidator.IsCaptchaPassedAsync(captcha))
            {
                ModelState.AddModelError("captcha", "Captcha validation failed");

                return(View(new BookResult()
                {
                    IsSuccess = false, Message = "Captcha validation failed"
                }));
            }
            else
            {
                return(RedirectToAction("Result", _service.Add(new Ticket())));
            }
        }
Ejemplo n.º 8
0
 private void btnSellTicket_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(selectedSeat))
     {
         MessageBox.Show("Lütfen Koltuk Şeçimi Yapınız ");
     }
     else
     {
         _ticketService.Add(new Ticket
         {
             Date         = DateTime.Now.Date,
             Price        = selectedSeatNumber * 11m,
             TheaterId    = (int)dgvMovieList.CurrentRow.Cells[0].Value,
             SelectedSeat = selectedSeat
         });
         MessageBox.Show("Bilet Satış İşleminiz Gerçekleştirilmiştir İyi Seyirler Dileriz");
         GetAllSellTicket();
         newCreateTicket();
     }
 }
Ejemplo n.º 9
0
        public void RefreshTickets()
        {
            int    price     = trainService.Get(SelectedTrainId).Data.RoutePropereties.Last().Price;
            VanDTO neededVan = vanService.Get(SelectedVanId).Data;

            int idClass = neededVan.ClassProperetiesId;

            price += classProperetiesService.Get(idClass).Data.Price;

            int passangerId = passangerService.GetAll()
                              .Data.Last().Id;


            TicketDTO ticket = new TicketDTO()
            {
                VanId       = SelectedVanId,
                SeatId      = SelectedSeatId,
                TrainId     = SelectedTrainId,
                Price       = price,
                PassangerId = passangerId
            };

            SelectedStation = stationService.Get(SelectedStationId).Data;
            SelectedTrain   = trainService.Get(SelectedTrainId).Data;
            SelectedVan     = vanService.Get(SelectedVanId).Data;
            SelectedSeat    = seatService.Get(SelectedSeatId).Data;

            ticketService.Add(ticket);

            ticketService.Save();

            Ticket = ticket;
            OnPropertyChanged(nameof(SelectedStation));
            OnPropertyChanged(nameof(SelectedTrain));
            OnPropertyChanged(nameof(SelectedVan));
            OnPropertyChanged(nameof(SelectedSeat));
            OnPropertyChanged(nameof(Ticket));
            OnPropertyChanged(nameof(Stations));
        }
Ejemplo n.º 10
0
 public async Task <BookResult> BookTicket(Ticket ticket)
 {
     return(await Task.FromResult(_service.Add(ticket)).ConfigureAwait(false));
 }
Ejemplo n.º 11
0
        public IHttpActionResult Create(TicketModel model)
        {
            var newModel = _service.Add(model);

            return(Ok(newModel));
        }
Ejemplo n.º 12
0
 // POST: api/WSTicket
 public IHttpActionResult Post([FromBody] Ticket value)
 {
     ts.Add(value);
     ts.Commit();
     return(Ok("ajoute"));
 }
Ejemplo n.º 13
0
        public async Task <IActionResult> Add([FromBody] Ticket ticket)
        {
            var responseInfo = await _service.Add(ticket);

            return(Ok(responseInfo));
        }
Ejemplo n.º 14
0
        public IHttpActionResult Post([FromBody] TicketDTO ticket)
        {
            var ticketAdded = _ticketService.Add(ticket);

            return(CreatedAtRoute("DefaultApi", new { id = ticket.TicketId }, ticketAdded));
        }