Пример #1
0
        public virtual ActionResult Edit(string id)
        {
            var model = GameEditModel.FromDomain(Games.Get(id), Accounting);

            ViewData["groups"] = GroupSummaries;
            ViewData["users"]  = UserSummaries[model.Availability.Users ?? new string[0]];
            return(View(model));
        }
Пример #2
0
		public static GameEditModel FromDomain(Game g, IAccountingService accounting)
		{
			var x = new GameEditModel {
                Type = g.Type,
                Award = g.Award,
                TimeLimit = g.TimeLimit,
			};
            x.Init(g, accounting);
            return x;
		}
Пример #3
0
        public static GameEditModel FromDomain(Game g, IAccountingService accounting)
        {
            var x = new GameEditModel {
                Type      = g.Type,
                Award     = g.Award,
                TimeLimit = g.TimeLimit,
            };

            x.Init(g, accounting);
            return(x);
        }
Пример #4
0
        public virtual ActionResult Edit(string id, GameEditModel g)
        {
            var x = Games.Get(id);

            if (!ModelState.IsValid)
            {
                return(View(g));
            }
            try
            {
                g.Apply(x, Accounting);
                Games.Save(x);
                return(this.RedirectToAction(c => c.Index()));
            }
            catch (Exception ex)
            {
                ViewData["groups"] = GroupSummaries;
                ViewData["users"]  = UserSummaries[g.Availability.Users ?? new string[0]];
                Notifier.Notify(ex);
                return(View(g));
            }
        }
Пример #5
0
        public virtual ActionResult Edit(string id, GameEditModel g)
        {
			var x = Games.Get(id);
			if (!ModelState.IsValid)
			{
				return View(g);
			}
            try
            {
                g.Apply(x, Accounting);
				Games.Save(x);
                return this.RedirectToAction(c => c.Index());
            }
            catch (Exception ex)
            {
                ViewData["groups"] = GroupSummaries;
                ViewData["users"] = UserSummaries[g.Availability.Users ?? new string[0]];
				Notifier.Notify(ex);
                return View(g);
            }
        }