public AccessRight UpdateAccessRight(AccessRight accessRight) { var dbContext = new DataContext(); var dbAccessRight = GetDbAccessRight(dbContext, accessRight.AccessRightId); if (dbAccessRight != null) { dbAccessRight.Name = accessRight.Name; dbContext.SaveChanges(); } return(new AccessRight(dbAccessRight)); }
public AccessRight GetAccessRight(Guid accessRightId) { AccessRight accessRight = null; var dbAccessRight = GetDbAccessRight(new DataContext(), accessRightId); if (dbAccessRight != null) { accessRight = new AccessRight(dbAccessRight); } return(accessRight); }
public AccessRight AddAccessRight(AccessRight accessRight) { var dbContext = new DataContext(); var dbAccessRight = new DbAccessRight(); dbAccessRight.DbAccessRightId = accessRight.AccessRightId; dbAccessRight.Name = accessRight.Name; dbAccessRight = dbContext.DbAccessRights.Add(dbAccessRight); dbContext.SaveChanges(); return(new AccessRight(dbAccessRight)); }
public UserAccessRight(DbUserAccessRight dbUserAccessRight) { UserAccessRightId = dbUserAccessRight.DbUserAccessRightId; AccessRight = new AccessRight(dbUserAccessRight.DbAccessRight); User = new User(dbUserAccessRight.DbUser); }