Exemplo n.º 1
0
        public async Task <IActionResult> Pay(int id, byte count = 1)
        {
            var eventt = await EventRepo.GetById(id);

            if (eventt.TickLeft >= count)
            {
                var purchase = new Purchase();
                purchase.UserId  = currentUser.Id;
                purchase.Count   = count;
                purchase.EventId = eventt.Id;

                try
                {
                    await PurchaseRepo.Add(purchase);

                    return(message(MessageType.success));
                }

                catch
                {
                    return(message(MessageType.danger));
                }
            }

            return(message("ظرفیت کمتر از تعداد درخواست شماست", MessageType.danger));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id)
        {
            var model = await EventRepo.GetById(id);

            ViewBag.Cities = await db.Cities
                             .Select(x => new SelectListItem {
                Text = x.Title, Value = x.Id.ToString()
            })
                             .ToListAsync();

            ViewBag.Categories = await db.Categories
                                 .Select(x => new SelectListItem {
                Text = x.Title, Value = x.Id.ToString()
            })
                                 .ToListAsync();

            return(PartialView(model));
        }
Exemplo n.º 3
0
 public ActionResult Details(int id)
 {
     return(PartialView("_Details", EventRepo.GetById(id)));
 }
Exemplo n.º 4
0
 public ActionResult Edit(int id)
 {
     return(PartialView("_Edit", EventRepo.GetById(id)));
 }