public IEnumerable <Skill> Get() { if (_skillList == null || _skillListStale) { _skillList = _skillRepository.Get().ToList(); } return(_skillList); }
public ActionResult RemoveCompanySkill(int skillId, int companyId) { var company = _companyRepository.GetCompanyWithDetails(companyId); var skill = _skillRepository.Get(skillId); if (company == null || skill == null) { return(HttpNotFound()); } _companySkillRepository.Remove(companyId, skillId); return(Json(string.Empty)); }
// GET: Skills/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Skill skill = repo.Get(id.Value); if (skill == null) { return(HttpNotFound()); } return(View(skill)); }
public SkillTemplate GetSkillById(int id) { using (var context = new GameDatabaseContext()) { var repo = new SkillRepository(context); return repo.Get(id); } }
public override void UseItemOn(Character character, Character user) { var player = character as Player; if (player != null) { using (var context = new GameDatabaseContext()) { var skillRepo = new SkillRepository(context); var skillTemplate = skillRepo.Get(ItemTemplate.LearntSkillId); player.AddSkill(new Skill(skillTemplate)); } } else { Logger.Instance.Warn("You cannot use a skillbook on a non-player target."); } }
public void CanUpdateSkill() { //Arrange var context = GetSqlLiteContext(); var cvRepository = new CvRepository(context); var skillRepository = new SkillRepository(context); var cv = new Cv() { Name = Constants.CvName, TagLine = Constants.CvTagLine, Blurb = Constants.CvBlurb }; cvRepository.Add(cv); var cvId = cvRepository.Get()[0].Id; var skill = new Skill() { Name = "Continuous Delivery", Blurb = "Awesome at CI and CD" }; skillRepository.AddToCv(skill, cvId); var skillId = skillRepository.GetForCv(cvId)[0].Id; //Act var skillUpdate = new Skill() { Id = skillId, Name = "C#", Blurb = "Been using it since 2001." }; skillRepository.Update(skillUpdate); //Assert var result = skillRepository.Get(skillId); Assert.AreEqual(skillUpdate.Name, result.Name); Assert.AreEqual(skillUpdate.Blurb, result.Blurb); Assert.AreEqual(cvId, result.Cv.Id); }
public ActionResult <OkResponse <IEnumerable <SkillDto> > > Get(string username) { var skills = skillRepository.Get(username).ToList(); return(Ok(new OkResponse <List <SkillDto> >(skills))); }
public RJMQuery( DocumentRepository documentRepository, DocumentTypeRepository documentTypeRepository, ResumeRepository resumeRepository, ResumeStateRepository resumeStateRepository, SkillRepository skillRepository, SkillAliasRepository skillAliasRepository, JobRepository jobRepository, JobStateRepository jobStateRepository ) { this.AuthorizeWith("Authorized"); // Documents Field <ListGraphType <DocumentType> >( "documents", resolve: context => documentRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<DocumentType>>( // "documents", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await documentRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <DocumentType>( "document", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => documentRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<DocumentType>( // "document", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await documentRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // DocumentTypes Field <ListGraphType <DocumentTypeType> >( "documentTypes", resolve: context => documentTypeRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<DocumentTypeType>>( // "documentTypes", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await documentTypeRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <DocumentTypeType>( "documentType", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => documentTypeRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<DocumentTypeType>( // "documentType", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await documentTypeRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // Resumes Field <ListGraphType <ResumeType> >( "resumes", resolve: context => resumeRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<ResumeType>>( // "resumes", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await resumeRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <ResumeType>( "resume", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => resumeRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<ResumeType>( // "resume", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await resumeRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // ResumeStates Field <ListGraphType <ResumeStateType> >( "resumeStates", resolve: context => resumeStateRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<ResumeStateType>>( // "resumeStates", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await resumeStateRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <ResumeStateType>( "resumeState", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => resumeStateRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<ResumeStateType>( // "resumeState", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await resumeStateRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // Skills Field <ListGraphType <SkillType> >( "skills", resolve: context => skillRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<SkillType>>( // "skills", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await skillRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <SkillType>( "skill", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => skillRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<SkillType>( // "skill", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await skillRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // SkillAliases Field <ListGraphType <SkillAliasType> >( "skillAliases", resolve: context => skillAliasRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<SkillAliasType>>( // "skillAliases", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await skillAliasRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <SkillAliasType>( "skillAlias", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => skillAliasRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<SkillAliasType>( // "skillAlias", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await skillAliasRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // Jobs Field <ListGraphType <JobType> >( "jobs", resolve: context => jobRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<JobType>>( // "jobs", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await jobRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <JobType>( "job", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => jobRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<JobType>( // "job", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await jobRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); // JobStates Field <ListGraphType <JobStateType> >( "jobStates", resolve: context => jobStateRepository.Get(null, x => x.OrderByDescending(x => x.ModifiedOn)) ); //// Async test //FieldAsync<ListGraphType<JobStateType>>( // "jobStates", // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await jobStateRepository.GetAsync(null, x => x.OrderByDescending(x => x.ModifiedOn)) // ); // } //); Field <JobStateType>( "jobState", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id" }), resolve: context => jobStateRepository.GetById(context.GetArgument <Guid>("id")) ); //// Async test //FieldAsync<JobStateType>( // "jobState", // arguments: new QueryArguments(new QueryArgument<NonNullGraphType<IdGraphType>> { Name = "id" }), // resolve: async context => // { // return await context.TryAsyncResolve( // async c => await jobStateRepository.GetByIdAsync(context.GetArgument<Guid>("id")) // ); // } //); }