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)); }
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)); }
public ActionResult Details(int id) { return(PartialView("_Details", EventRepo.GetById(id))); }
public ActionResult Edit(int id) { return(PartialView("_Edit", EventRepo.GetById(id))); }