예제 #1
0
        public ActionResult Create(CreateAbsenceViewModel vm)
        {
            if (ModelState.IsValid == false)
            {
                CreatePlayerSelectList();
                return View(vm);
            }

            var absence = Absence.Create(vm.From, vm.To, vm.Player, vm.Comment);
            DocumentSession.Store(absence);

            return RedirectToAction("Index");
        }
예제 #2
0
        public ActionResult Edit(int id, CreateAbsenceViewModel vm)
        {
            if (ModelState.IsValid == false)
            {
                CreatePlayerSelectList();
                return View(vm);
            }

            var absence = DocumentSession.Load<Absence>(id);
            absence.Player = vm.Player;
            absence.From = vm.From;
            absence.To = vm.To;
            absence.Comment = vm.Comment;
            return RedirectToAction("Index");
        }