Пример #1
0
        // GET: Game
        public ActionResult Index()
        {
            var userId = Guid.Parse(User.Identity.GetUserId());
            var model  = new HolderModel(userId);

            model.dayCre = new DayCommentCreate {
                OwnerID = userId
            };
            return(View(model));
        }
Пример #2
0
        public ActionResult IndexFuncPar(string id, string owner, string reason, string colors, string planets, string conns, string lastMove, string wasGoodStr, string step)
        {
            bool        wasGood = Boolean.Parse(wasGoodStr);
            HolderModel model   = new HolderModel(Guid.Parse(owner));

            model.dayCre = new DayCommentCreate {
                OwnerID = Guid.Parse(owner)
            };
            model.dayCre.Reason      = reason;
            model.dayCre.OwnerID     = (model.map.OwnerID = Guid.Parse(owner));
            model.dayCre.Move        = step;
            model.dayCre.WasGood     = wasGood;
            model.dayCre.CreatedDate = DateTimeOffset.Now;
            model.map.Colours        = colors.Replace("%20", " ").Replace("%23", "#").Replace("%COMMA", ",");
            model.map.Edges          = conns;
            model.map.LastMove       = DateTimeOffset.Parse(lastMove);
            model.map.Planets        = planets;
            return(IndexFunc(model));
        }
Пример #3
0
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        public ActionResult IndexFunc(HolderModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var mapService = CreateMapService();
            var dayService = CreateCommentService();

            if (mapService.UpdateMap(model.map) && dayService.CreateComment(model.dayCre))
            {
                TempData["SaveResult"] = "Everything saved successfully";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "Ruh roh. Something broke...");
            return(View(model));
        }