public ProficiencyChoiceViewModel(ProficiencyType type, List <Proficiency> profs = null, int totalBonus = 1, bool canSelectMultiple = false) { this._type = type; if (profs != null) { foreach (var prof in profs) { prof.Type = type; } Items.AddRange(profs); } }
public IActionResult Create([FromBody] ProficiencyType newmodel) { if (ModelState.IsValid) { _context.ProficiencyType.Add(newmodel); _context.SaveChanges(); return(CreatedAtRoute("GetProficiencyType", new { id = newmodel.ProficiencyTypeID }, newmodel)); } else { return(BadRequest()); } }
/// <summary> /// gets a list of all proficiencies of a given type gained by subrace, class, subclass and background /// </summary> /// <param name="type">requested type</param> /// <param name="subrace">chosen subrace</param> /// <param name="className">chosen class</param> /// <param name="subclass">chosen subclass</param> /// <param name="background">chosen background</param> private List <string> getProficienciesByType(ProficiencyType type, string subrace, string className, string subclass, string background) { List <string> proficiencies = new List <string>(); using (SQLiteConnection connection = new SQLiteConnection(ConnectionString)) using (SQLiteCommand command = new SQLiteCommand(connection)) { connection.Open(); command.CommandText = "SELECT proficiencies FROM extraRaceProficiencies " + "INNER JOIN races ON extraRaceProficiencies.raceId=races.raceid " + "WHERE races.subrace=@Subrace AND extraRaceProficiencies.type=@Type " + "UNION " + "SELECT proficiencies FROM extraClassProficiencies " + "INNER JOIN classes ON extraClassProficiencies.classId=classes.classid " + "WHERE classes.name=@Class AND extraClassProficiencies.type=@Type " + "UNION " + "SELECT proficiencies FROM extraSubclassProficiencies " + "INNER JOIN subclasses ON extraSubclassProficiencies.subclassId=subclasses.subclassId " + "WHERE subclasses.name=@Subclass AND extraSubclassProficiencies.type=@Type " + "UNION " + "SELECT proficiencies FROM extraBackgroundProficiencies " + "INNER JOIN backgrounds ON extraBackgroundProficiencies.backgroundId=backgrounds.backgroundId " + "WHERE backgrounds.name=@Background AND extraBackgroundProficiencies.type=@Type"; command.Parameters.AddWithValue("@Type", type.ToString()); command.Parameters.AddWithValue("@Subrace", subrace); command.Parameters.AddWithValue("@Class", className); command.Parameters.AddWithValue("@Subclass", subclass); command.Parameters.AddWithValue("@Background", background); using (SQLiteDataReader dbReader = command.ExecuteReader()) { while (dbReader.Read()) { if (!dbReader.IsDBNull(0)) { proficiencies.Add(dbReader.GetString(0)); } } } } return(proficiencies); }
public IActionResult UpdateEntry([FromBody] ProficiencyType objupd) { var targetObject = _context.ProficiencyType.FirstOrDefault(t => t.ProficiencyTypeID == objupd.ProficiencyTypeID); if (targetObject == null) { return(NotFound()); } _context.Entry(targetObject).CurrentValues.SetValues(objupd); ReturnData ret; ret = _context.SaveData(); if (ret.Message == "Success") { return(Ok()); } return(NotFound(ret)); }
public void ProficiencyType() { IQueryable <ProficiencyType> ProficiencyTypeCollection = Enumerable.Empty <ProficiencyType>().AsQueryable(); ProficiencyType ct = new ProficiencyType { ProficiencyTypeID = 1, ProficiencyTypeName = "Test PT" }; Mock <IProficiencyTypeRepository> ProficiencyTypeService = new Mock <IProficiencyTypeRepository>(); object obj = new object(); try { ProficiencyTypeService.Setup(x => x.GetAll()).Returns(ProficiencyTypeCollection); ProficiencyTypeService.Setup(x => x.Get(It.IsAny <int>())).Returns(ct); ProficiencyTypeService.Setup(x => x.Add(It.IsAny <ProficiencyType>())).Returns(ct); ProficiencyTypeService.Setup(x => x.Delete(It.IsAny <ProficiencyType>())).Verifiable(); ProficiencyTypeService.Setup(x => x.Update(It.IsAny <ProficiencyType>(), It.IsAny <object>())).Returns(ct); var ProficiencyTypeObject = ProficiencyTypeService.Object; var p1 = ProficiencyTypeObject.GetAll(); var p2 = ProficiencyTypeObject.Get(1); var p3 = ProficiencyTypeObject.Update(ct, obj); var p4 = ProficiencyTypeObject.Add(ct); ProficiencyTypeObject.Delete(ct); Assert.IsAssignableFrom <IQueryable <ProficiencyType> >(p1); Assert.IsAssignableFrom <ProficiencyType>(p2); Assert.Equal("Test PT", p2.ProficiencyTypeName); Assert.Equal("Test PT", p3.ProficiencyTypeName); ProficiencyTypeService.VerifyAll(); ProficiencyTypeObject.Dispose(); } finally { ProficiencyTypeService = null; } }
/// <summary> /// Returns the internal name for this proficiency type. /// </summary> /// <param name="type"></param> /// <returns></returns> public static string InternalName(this ProficiencyType type) { return(InternalNames[type]); }
/// <summary> /// Returns the a readable name for this proficiency type. /// </summary> /// <param name="type"></param> /// <returns></returns> public static string ToString(this ProficiencyType type) { return(type.ProficiencyName()); }
public ProficienciesListVM(ProficiencyType type) { this.Type = type; }
/// <summary> /// Returns a specific proficiency given its type. /// </summary> /// <param name="type"></param> /// <returns></returns> public Proficiency GetProficiency(ProficiencyType type) { return(proficiencies[type]); }
public void SetProficiency(ProficiencyType type) { mUserState.mProficiencyType = type; }
public IActionResult Update([FromBody] ProficiencyType editentry) { var result = _repository.Update(editentry, editentry.ProficiencyTypeID); return(Helper.CheckResult(result)); }
public IActionResult Create([FromBody] ProficiencyType newentry) { var result = _repository.Add(newentry); return(CreatedAtRoute("GetProficiencyType", new { id = newentry.ProficiencyTypeID }, newentry)); }
public static ObservableCollection <IProficiency> AllProficienciesOfType(ProficiencyType type) => type switch {
public Proficiency(ProficiencyType type, string name = "") { Type = type; Name = name; }
public static T SetProficiencyType <T>(this T entity, ProficiencyType value) where T : FeatureDefinitionProficiency { entity.SetField("proficiencyType", value); return(entity); }
/// <summary> /// Returns a readable name for this proficiency type. /// </summary> /// <param name="type"></param> /// <returns></returns> public static string ProficiencyName(this ProficiencyType type) { return(ProficiencyNames[type]); }
public IEnumerable <IProficiency> GetAllForType(ProficiencyType type) { return(this.Where(p => p.ProficiencyType == type)); }
internal void PopulateData() { using (var context = new AppDbContext(options, null)) { if (context.AppUserAbsence.Count() < 1) { var p1 = new AppUserAbsence { AppUserAbsenceID = 1, Notes = "absence type 1", }; var p2 = new AppUserAbsence { AppUserAbsenceID = 2, Notes = "absence type 2", }; context.AppUserAbsence.Add(p1); context.AppUserAbsence.Add(p2); context.SaveChanges(); } if (context.AppUserAddress.Count() < 1) { var p1 = new AppUserAddress { AppUserAddressID = 1, Address1 = "address type 1", CountryID = 1, AddressTypeID = 1 }; var p2 = new AppUserAddress { AppUserAddressID = 2, Address1 = "address type 2", CountryID = 1, AddressTypeID = 1 }; context.AppUserAddress.Add(p1); context.AppUserAddress.Add(p2); var p3 = new Country { CountryID = 1, CountryName = "test country" }; context.Country.Add(p3); var p4 = new AddressType { AddressTypeID = 1, AddressTypeName = "test address type" }; context.AddressType.Add(p4); context.SaveChanges(); } if (context.AppUserCertificate.Count() < 1) { var p1 = new AppUserCertificate { AppUserCertificateID = 1, CreatedBy = "user1", }; var p2 = new AppUserCertificate { AppUserCertificateID = 2, CreatedBy = "user1", }; context.AppUserCertificate.Add(p1); context.AppUserCertificate.Add(p2); context.SaveChanges(); } if (context.AppUserContact.Count() < 1) { var p1 = new AppUserContact { AppUserContactID = 1, ContactTypeID = 1, CreatedBy = "user1", }; var p2 = new AppUserContact { AppUserContactID = 2, ContactTypeID = 1, CreatedBy = "user1", }; context.AppUserContact.Add(p1); context.AppUserContact.Add(p2); if (context.ContactType.Count() < 1) { var p3 = new ContactType { ContactTypeID = 1, ContactTypeName = "user1" }; context.ContactType.Add(p3); } context.SaveChanges(); } if (context.AppUserContract.Count() < 1) { var p1 = new AppUserContract { AppUserContractID = 1, ContractTypeID = 1, CreatedBy = "user1", }; var p2 = new AppUserContract { AppUserContractID = 2, ContractTypeID = 1, CreatedBy = "user1", }; context.AppUserContract.Add(p1); context.AppUserContract.Add(p2); if (context.ContractType.Count() < 1) { var p3 = new ContractType { ContractTypeID = 1, ContractTypeName = "contract 1" }; context.ContractType.Add(p3); } context.SaveChanges(); } if (context.AppUserCountry.Count() < 1) { var p1 = new AppUserCountry { AppUserCountryID = 1, CountryID = 1, CreatedBy = "user1", }; var p2 = new AppUserCountry { AppUserCountryID = 2, CountryID = 1, CreatedBy = "user1", }; context.AppUserCountry.Add(p1); context.AppUserCountry.Add(p2); if (context.Country.Count() < 1) { var p3 = new Country { CountryID = 1, CountryName = "country 1" }; context.Country.Add(p3); } context.SaveChanges(); } if (context.AppUserEducation.Count() < 1) { var p1 = new AppUserEducation { AppUserEducationID = 1, EducationTypeID = 1, CreatedBy = "user1", }; var p2 = new AppUserEducation { AppUserEducationID = 2, EducationTypeID = 1, CreatedBy = "user1", }; context.AppUserEducation.Add(p1); context.AppUserEducation.Add(p2); if (context.EducationType.Count() < 1) { var p3 = new EducationType { EducationTypeID = 1, EducationName = "education type 1" }; context.EducationType.Add(p3); } context.SaveChanges(); } if (context.AppUserEmploymentRecord.Count() < 1) { var p1 = new AppUserEmploymentRecord { AppUserEmploymentRecordID = 1, ContractTypeID = 1, DepartureTypeID = 1, CreatedBy = "user1", }; var p2 = new AppUserEmploymentRecord { AppUserEmploymentRecordID = 2, ContractTypeID = 1, DepartureTypeID = 1, CreatedBy = "user1", }; context.AppUserEmploymentRecord.Add(p1); context.AppUserEmploymentRecord.Add(p2); if (context.ContractType.Count() < 1) { var p3 = new ContractType { ContractTypeID = 1, ContractTypeName = "contract type 1" }; context.ContractType.Add(p3); } if (context.DepartureType.Count() < 1) { var p3 = new DepartureType { DepartureTypeID = 1, DepartureTypeName = "departure type 1" }; context.DepartureType.Add(p3); } context.SaveChanges(); } if (context.AppUserFunction.Count() < 1) { var p1 = new AppUserFunction { AppUserFunctionID = 1, FunctionTypeID = 1, CreatedBy = "user1", }; var p2 = new AppUserFunction { AppUserFunctionID = 2, FunctionTypeID = 1, CreatedBy = "user1", }; context.AppUserFunction.Add(p1); context.AppUserFunction.Add(p2); if (context.FunctionType.Count() < 1) { var p3 = new FunctionType { FunctionTypeID = 1, FunctionTypeName = "function type 1" }; context.FunctionType.Add(p3); } context.SaveChanges(); } if (context.AppUserInRole.Count() < 1) { var p1 = new AppUserInRole { AppUserInRoleID = 1, RoleTypeID = 1, CreatedBy = "user1", }; var p2 = new AppUserInRole { AppUserInRoleID = 2, RoleTypeID = 1, CreatedBy = "user1", }; context.AppUserInRole.Add(p1); context.AppUserInRole.Add(p2); if (context.RoleType.Count() < 1) { var p3 = new RoleType { RoleTypeID = 1, RoleTypeName = "role type 1" }; context.RoleType.Add(p3); } context.SaveChanges(); } if (context.AppUserLanguage.Count() < 1) { var p1 = new AppUserLanguage { AppUserLanguageID = 1, LanguageTypeID = 1, ProficiencyTypeID = 1, CreatedBy = "user1", }; var p2 = new AppUserLanguage { AppUserLanguageID = 2, LanguageTypeID = 1, ProficiencyTypeID = 1, CreatedBy = "user1", }; context.AppUserLanguage.Add(p1); context.AppUserLanguage.Add(p2); if (context.LanguageType.Count() < 1) { var p3 = new LanguageType { LanguageTypeID = 1, LanguageTypeName = "language type 1" }; context.LanguageType.Add(p3); } if (context.ProficiencyType.Count() < 1) { var p3 = new ProficiencyType { ProficiencyTypeID = 1, ProficiencyTypeName = "proficiency type 1" }; context.ProficiencyType.Add(p3); } context.SaveChanges(); } if (context.AppUserNote.Count() < 1) { var p1 = new AppUserNote { AppUserNoteID = 1, CreatedBy = "user1", }; var p2 = new AppUserNote { AppUserNoteID = 2, CreatedBy = "user1", }; context.AppUserNote.Add(p1); context.AppUserNote.Add(p2); context.SaveChanges(); } if (context.AppUserResearchTeam.Count() < 1) { var p1 = new AppUserResearchTeam { AppUserResearchTeamID = 1, CreatedBy = "user1", }; var p2 = new AppUserResearchTeam { AppUserResearchTeamID = 2, CreatedBy = "user1", }; context.AppUserResearchTeam.Add(p1); context.AppUserResearchTeam.Add(p2); context.SaveChanges(); } if (context.AppUserTeamAssignment.Count() < 1) { var p1 = new AppUserTeamAssignment { AppUserTeamAssignmentID = 1, TeamID = 1, AssignmentTypeID = 1, CreatedBy = "user1", }; var p2 = new AppUserTeamAssignment { AppUserTeamAssignmentID = 2, TeamID = 1, AssignmentTypeID = 1, CreatedBy = "user1", }; context.AppUserTeamAssignment.Add(p1); context.AppUserTeamAssignment.Add(p2); if (context.Team.Count() < 1) { var p3 = new Team { TeamID = 1, TeamName = "team 1" }; context.Team.Add(p3); } if (context.AssignmentType.Count() < 1) { var p4 = new AssignmentType { AssignmentTypeID = 1, AssignmentTypeName = "assignment type 1" }; context.AssignmentType.Add(p4); } context.SaveChanges(); } if (context.AppUserTeam.Count() < 1) { var p1 = new AppUserTeam { AppUserTeamID = 1, TeamID = 1, CreatedBy = "user1", }; var p2 = new AppUserTeam { AppUserTeamID = 2, TeamID = 1, CreatedBy = "user1", }; context.AppUserTeam.Add(p1); context.AppUserTeam.Add(p2); if (context.Team.Count() < 1) { var p3 = new Team { TeamID = 1, TeamName = "team 1" }; context.Team.Add(p3); } context.SaveChanges(); } } }