Пример #1
0
        public ActionResult Create( Challenge challenge )
        {
            if ( ModelState.IsValid )
            {
                challenge = (Challenge)TimeZoneUtil.ToUTC( challenge );
                challenge.CreateDate = DateTime.UtcNow;

                challenge.Description = HttpUtility.HtmlDecode( challenge.Description );

                db.Challenges.Add( challenge );
                db.SaveChanges();
                return RedirectToAction( "Index" );
            }

            return View( challenge );
        }
Пример #2
0
        public ActionResult Edit( Challenge challenge )
        {
            if ( ModelState.IsValid )
            {
                challenge = (Challenge)TimeZoneUtil.ToUTC( challenge );
                challenge.Description = HttpUtility.HtmlDecode( challenge.Description );

                db.Entry( challenge ).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction( "Index" );
            }
            return View( challenge );
        }