Ejemplo n.º 1
0
 public ActionResult Create()
 {
     var vm = new CreateRosterViewModel
         {
             Season = DocumentSession.LatestSeasonOrDefault(DateTime.Now.Year)
         };
     return View(vm);
 }
Ejemplo n.º 2
0
        public ActionResult Create(CreateRosterViewModel vm)
        {
            if (!ModelState.IsValid) return View(vm);

            var roster = new Roster(
                vm.Season,
                vm.Turn,
                vm.BitsMatchId,
                vm.Team,
                vm.TeamLevel,
                vm.Location,
                vm.Opponent,
                vm.Date,
                vm.IsFourPlayer);
            DocumentSession.Store(roster);
            return RedirectToAction("Index");
        }
Ejemplo n.º 3
0
        public ActionResult Edit(string id, CreateRosterViewModel vm)
        {
            if (!ModelState.IsValid)
                return View(vm);

            var roster = DocumentSession.Load<Roster>(id);
            if (roster == null) throw new HttpException(404, "Roster not found");

            roster.Location = vm.Location;
            roster.Opponent = vm.Opponent;
            roster.Season = vm.Season;
            roster.Team = vm.Team;
            roster.TeamLevel = vm.TeamLevel;
            roster.Turn = vm.Turn;
            roster.BitsMatchId = vm.BitsMatchId;
            roster.IsFourPlayer = vm.IsFourPlayer;
            roster.Date = vm.Date;

            return RedirectToAction("Index");
        }