示例#1
0
 /// <summary>
 /// Deletes the specified character.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="id">The identifier.</param>
 internal static void Delete(DndDmHelperContext context, int id)
 {
     context.TemplateCharacters.Remove(context.TemplateCharacters.Find(id));
 }
示例#2
0
 /// <summary>
 /// Deletes the specified race.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="id">The identifier.</param>
 internal static void Delete(DndDmHelperContext context, int id)
 {
     context.Races.Remove(context.Races.Find(id));
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NoteRepository"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 public NoteRepository(DndDmHelperContext context)
 {
     this.context = context;
 }
示例#4
0
 /// <summary>
 /// Gets all the races.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <returns></returns>
 internal static IEnumerable <RaceDTO> GetAll(DndDmHelperContext context)
 {
     return(context.Races
            .Select(e => RaceDTO.CreateDTOFromRace(e)));
 }
示例#5
0
 /// <summary>
 /// Gets the dto.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 internal static RaceDTO GetDTO(DndDmHelperContext context, int id)
 {
     return(context.Races
            .Select(e => RaceDTO.CreateDTOFromRace(e))
            .FirstOrDefault(e => e.ID == id));
 }
示例#6
0
        public static List <Skill> Seed(DndDmHelperContext context)
        {
            List <Skill> seed = new List <Skill>();

            if (context.Skills.FirstOrDefault(e => e.Name == "Acrobatics") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Acrobatics", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Animal Handling") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Animal Handling", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Arcana") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Arcana", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Athletics") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Athletics", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Deception") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Deception", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "History") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "History", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Insight") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Insight", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Intimidation") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Intimidation", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Investigation") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Investigation", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Medicine") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Medicine", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Nature") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Nature", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Perception") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Perception", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Performance") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Performance", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Persuasion") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Persuasion", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Religion") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Religion", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Religion") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Religion", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Sleight of Hand") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Sleight of Hand", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Stealth") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Stealth", Default = true
                });
            }
            if (context.Skills.FirstOrDefault(e => e.Name == "Survival") == null)
            {
                seed.Add(new Skill()
                {
                    Name = "Survival", Default = true
                });
            }

            return(seed);
        }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SkillRepository"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 public SkillRepository(DndDmHelperContext context)
 {
     this.context = context;
 }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClassRepository"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 public ClassRepository(DndDmHelperContext context)
 {
     this.context = context;
 }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UnitOfWork"/> class.
 /// </summary>
 public UnitOfWork()
 {
     context = new DndDmHelperContext();
 }
示例#10
0
文件: User.cs 项目: Worble/DndHelper
 /// <summary>
 /// Checks the email is unique.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="emailAddress">The email address.</param>
 /// <returns></returns>
 internal static bool CheckUniqueEmail(DndDmHelperContext context, string emailAddress)
 {
     return(context.Users.FirstOrDefault(e => e.EmailAddress == emailAddress) == null ? true : false);
 }
示例#11
0
文件: User.cs 项目: Worble/DndHelper
 /// <summary>
 /// Gets the specified user.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 internal static UserDTO GetDTO(DndDmHelperContext context, int id)
 {
     return(context.Users
            .Select(e => UserDTO.GenerateDTOFromUser(e))
            .FirstOrDefault(e => e.ID == id));
 }
示例#12
0
文件: Class.cs 项目: Worble/DndHelper
 /// <summary>
 /// Gets the dto.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="id">The identifier.</param>
 /// <returns></returns>
 internal static ClassDTO GetDTO(DndDmHelperContext context, int id)
 {
     return(context.Classes
            .Select(e => ClassDTO.CreateDTOFromClass(e))
            .FirstOrDefault(e => e.ID == id));
 }
示例#13
0
文件: Class.cs 项目: Worble/DndHelper
 /// <summary>
 /// Gets all the classes
 /// </summary>
 /// <param name="context">The context.</param>
 /// <returns></returns>
 internal static IEnumerable <ClassDTO> GetAll(DndDmHelperContext context)
 {
     return(context.Classes
            .Select(e => ClassDTO.CreateDTOFromClass(e)));
 }
示例#14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GameCharacterRepository"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 public GameCharacterRepository(DndDmHelperContext context)
 {
     this.context = context;
 }
示例#15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClassRepository"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 public BaseStatRepository(DndDmHelperContext context)
 {
     this.context = context;
 }
示例#16
0
 internal static IEnumerable <SkillDTO> GetAll(DndDmHelperContext context)
 {
     return(context.Skills
            .Select(e => SkillDTO.GenerateDTOFromSkill(e)));
 }