public ActionResult Edit(Series series)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(series).State = EntityState.Modified;
         _db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(series));
 }
Beispiel #2
0
        public ActionResult Edit(ViewState viewState)
        {
            if (ModelState.IsValid)
            {
                State         newState  = _db.States.Find(viewState.Id);
                List <Series> newSeries = new List <Series>();
                int           i         = 0;

                newState.Serieses.Clear();

                foreach (var item in viewState.PostedSeries)
                {
                    Int32.TryParse(item, out i);

                    newSeries.Add(_db.Series.Find(i));
                }

                newState.Serieses = newSeries;



                _db.Entry(newState).State = EntityState.Modified;
                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(viewState));
        }
        public ActionResult StateSelect(FormCollection selectedState)
        {
            int userID = 0;

            string selected = selectedState["Id"];
            int    i        = 0;

            Int32.TryParse(selected, out i);

            if (User.Identity.IsAuthenticated)
            {
                userID = (int)Membership.GetUser(User.Identity.Name).ProviderUserKey;
            }

            UserProfile currentUser = _db.UserProfiles.Find(userID);

            currentUser.state = i;

            _db.Entry(currentUser).State = EntityState.Modified;
            _db.SaveChanges();

            return(RedirectToAction("Index", "FloorPlan"));
        }