public bool AddUpdatePermission(AccountPemission newPermission) { var retVal = false; try { using (var db = new SKMContext()) { var permission = db.AccountPemissions.FirstOrDefault(c => c.Name == newPermission.Name); if (permission == null) { db.AccountPemissions.Add(newPermission); db.Entry(newPermission).State = EntityState.Added; db.SaveChanges(); retVal = true; } else { retVal = true; } } } catch (Exception) { } return(retVal); }
public AccountPemission GetAccountPemission(string permissionName) { AccountPemission retVal = null; try { using (var db = new SKMContext()) { retVal = db.AccountPemissions.Where(p => p.Name == permissionName).Include(c => c.Roles).FirstOrDefault(); } } catch (Exception) { } return(retVal); }
public bool UpdateAccountPemission(AccountPemission permission) { var retVal = false; try { using (var db = new SKMContext()) { db.Entry(permission).State = EntityState.Modified; db.SaveChanges(); retVal = true; } } catch (Exception) { } return(retVal); }
public bool AddPermission(AccountPemission newPermission) { var retVal = false; try { using (var db = new SKMContext()) { db.AccountPemissions.Add(newPermission); db.Entry(newPermission).State = EntityState.Added; db.SaveChanges(); retVal = true; } } catch (Exception) { } return(retVal); }