public async Task <ActionResult> Edit([Bind(Include = "CategoryId,CategoryName,Decription")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Entry(category).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(category));
        }
Exemple #2
0
 public bool Update(T entity)
 {
     _dbContext.Set <T>().Attach(entity);
     _dbContext.Entry(entity).State = EntityState.Modified;
     return(_dbContext.SaveChanges() > 0);
 }