///<inheritdoc/> public void Update(int oldKey, RoleSwitch element) { var oldRoleSwitch = this.GetOne(oldKey); oldRoleSwitch = element; this.db.SaveChanges(); }
/// <summary> /// Logic to switch roles of user if everything is in order. /// </summary> /// <param name="roleName">The name of the role a user wants to join into.</param> /// <param name="userName">The username who wants a new role.</param> /// <returns>True if successful, false if not</returns> public bool RequestNewRole(string roleName, string userName) { if (!AlreadyAppliedForRole(userName)) { RoleSwitch newRoleSwitch = new RoleSwitch() { RoleName = roleName, UserName = userName }; this.roleSwitchRepository.Add(newRoleSwitch); return(true); } return(false); }
///<inheritdoc/> public void Add(RoleSwitch element) { this.db.Add(element); this.db.SaveChanges(); }