public async Task <IActionResult> AddAsync([FromRoute] string id, InputWinViewModel input, IFormFile file) { if (!this.ModelState.IsValid) { return(this.View(input)); } input.Url = await CloudinaryExtension.UploadAsync(this.cloudinary, file); var gamingHallId = await this.services.AddAsync(input.Url, input.Description, input.Date, id, input.SlotMachineId); this.TempData["Message"] = "Win was added successfully!"; return(this.Redirect("/Wins/All/" + gamingHallId)); }
public IActionResult Add([FromRoute] string id) { var hall = this.gamingHallService.GetT <UserIdHallViewModel>(id); var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); var exist = this.usersHallsService.IfExist(id, userId); if (hall == null || !exist) { return(this.View("NotFound")); } var machineNumbers = this.slotMachinesServices.All <MachineDropDownViewModel>(id); InputWinViewModel model = new InputWinViewModel { MachineNumbers = machineNumbers, }; return(this.View(model)); }