public ActionResult Create(CreateBetViewModel model) { if (ModelState.IsValid) { Bet bet = AutoMapper.Mapper.Map<Bet>(model); bet.StatusId = BetsRepository.GetStatusNumber(BetStatus.Applying); unitOfWork.BetsRepository.Create(bet); unitOfWork.Save(); RedirectToAction("Index"); } return View(model); }
public ActionResult CreateWithMultipleUsers(IEnumerable<string> users = null) { if (users == null) return RedirectToAction("AllUsers", "Home"); CreateBetViewModel model = new CreateBetViewModel(); model.Users = AutoMapper.Mapper.Map<IEnumerable<UserInfoViewModel>>(unitOfWork.UsersRepository.GetAll().Where(u => users.Contains(u.Id)).ToList()); model.AddInterests(unitOfWork.InterestsRepository.GetAll().ToList()); return View(model); }