Beispiel #1
0
        public ActionResult Edit(GenreViewModel genre)
        {
            genre g = genre.FromModel();

            if (ModelState.IsValid)
            {
                db.Entry(g).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(genre));
        }
Beispiel #2
0
        public ActionResult Create(GenreViewModel genre)
        {
            genre g = genre.FromModel();

            if (ModelState.IsValid)
            {
                db.genres.Add(g);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            //var jsonData = _jsonResponseFactory.CreateSuccessResponse("Added!");
            //return Json(jsonData, JsonRequestBehavior.AllowGet);
            return(View(genre));
        }