/// <inheritdoc/> public FriendViewItem CreateNewFriendViewItem(string characterName, string friendName) { var item = this.repositoryManager.CreateNew <FriendViewItem>(); using (var context = new EntityDataContext()) { item.CharacterId = context.Set <Character>().Where(character => character.Name == characterName).Select(character => character.Id).FirstOrDefault(); item.FriendId = context.Set <Character>().Where(character => character.Name == friendName).Select(character => character.Id).FirstOrDefault(); } // The names are available after commit and are not allowed to be set before. return(item); }
/// <inheritdoc/> public bool GuildWithNameExists(string name) { using (var context = new EntityDataContext()) { return(context.Set <Guild>().Any(guild => guild.Name == name)); } }