Exemplo n.º 1
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Image")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Entry(category).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(category));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Description,CategoryId,Image")] Feed feed)
        {
            if (ModelState.IsValid)
            {
                db.Entry(feed).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", feed.CategoryId);
            return(View(feed));
        }