Example #1
0
 public virtual void Delete(TEntity entityToDelete)
 {
     if (context.Entry(entityToDelete).State == EntityState.Detached)
     {
         dbSet.Attach(entityToDelete);
     }
     dbSet.Remove(entityToDelete);
 }
Example #2
0
#pragma warning disable CS0246 // The type or namespace name 'Role' could not be found (are you missing a using directive or an assembly reference?)
        public async Task <ActionResult> Edit([Bind(Include = "RoleId,RoleName")] Role role)
#pragma warning restore CS0246 // The type or namespace name 'Role' could not be found (are you missing a using directive or an assembly reference?)
        {
            if (ModelState.IsValid)
            {
                db.Entry(role).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(role));
        }