protected FieldRequestBase(int projectId, string name, string fieldHint, bool canPlayerEdit, bool canPlayerView, bool isPublic, MandatoryStatus mandatoryStatus, IReadOnlyCollection <int> showForGroups, bool validForNpc, bool includeInPrint, bool showForUnapprovedClaims, int price, string masterFieldHint, string programmaticValue) { ProjectId = projectId; Name = name; FieldHint = fieldHint; CanPlayerEdit = canPlayerEdit; CanPlayerView = canPlayerView; IsPublic = isPublic; MandatoryStatus = mandatoryStatus; ShowForGroups = showForGroups; ValidForNpc = validForNpc; IncludeInPrint = includeInPrint; ShowForUnapprovedClaims = showForUnapprovedClaims; Price = price; MasterFieldHint = masterFieldHint; ProgrammaticValue = programmaticValue; }
/// <inheritdoc /> public UpdateFieldRequest(int projectId, string name, string fieldHint, bool canPlayerEdit, bool canPlayerView, bool isPublic, MandatoryStatus mandatoryStatus, IReadOnlyCollection <int> showForGroups, bool validForNpc, bool includeInPrint, bool showForUnapprovedClaims, int price, string masterFieldHint, int projectFieldId, string programmaticValue) : base(projectId, name, fieldHint, canPlayerEdit, canPlayerView, isPublic, mandatoryStatus, showForGroups, validForNpc, includeInPrint, showForUnapprovedClaims, price, masterFieldHint, programmaticValue) { ProjectFieldId = projectFieldId; }
/// <inheritdoc /> public CreateFieldRequest(int projectId, ProjectFieldType fieldType, string name, string fieldHint, bool canPlayerEdit, bool canPlayerView, bool isPublic, FieldBoundTo fieldBoundTo, MandatoryStatus mandatoryStatus, IReadOnlyCollection <int> showForGroups, bool validForNpc, bool includeInPrint, bool showForUnapprovedClaims, int price, string masterFieldHint, string?programmaticValue) : base(projectId, name, fieldHint, canPlayerEdit, canPlayerView, isPublic, mandatoryStatus, showForGroups, validForNpc, includeInPrint, showForUnapprovedClaims, price, masterFieldHint, programmaticValue) { FieldType = fieldType; FieldBoundTo = fieldBoundTo; }
public async Task UpdateFieldParams(int projectId, int fieldId, string name, string fieldHint, bool canPlayerEdit, bool canPlayerView, bool isPublic, MandatoryStatus mandatoryStatus, List <int> showForGroups, bool validForNpc, bool includeInPrint, bool showForUnapprovedClaims) { var field = await ProjectRepository.GetProjectField(projectId, fieldId); field.RequestMasterAccess(CurrentUserId, acl => acl.CanChangeFields); field.FieldName = Required(name); field.Description = new MarkdownString(fieldHint); field.CanPlayerEdit = canPlayerEdit; field.CanPlayerView = canPlayerView; field.IsPublic = isPublic; field.IsActive = true; field.MandatoryStatus = mandatoryStatus; field.ValidForNpc = validForNpc; field.AvailableForCharacterGroupIds = await ValidateCharacterGroupList(projectId, showForGroups); field.IncludeInPrint = includeInPrint; field.ShowOnUnApprovedClaims = showForUnapprovedClaims; CreateOrUpdateSpecialGroup(field); await UnitOfWork.SaveChangesAsync(); }
public async Task AddField(int projectId, ProjectFieldType fieldType, string name, string fieldHint, bool canPlayerEdit, bool canPlayerView, bool isPublic, FieldBoundTo fieldBoundTo, MandatoryStatus mandatoryStatus, List <int> showForGroups, bool validForNpc, bool includeInPrint, bool showForUnapprovedClaims) { var project = await ProjectRepository.GetProjectAsync(projectId); project.RequestMasterAccess(CurrentUserId, acl => acl.CanChangeFields); var field = new ProjectField { FieldName = Required(name), Description = new MarkdownString(fieldHint), CanPlayerEdit = canPlayerEdit, CanPlayerView = canPlayerView, ValidForNpc = validForNpc, IsPublic = isPublic, ProjectId = projectId, Project = project, //We require it for CreateOrUpdateSpecailGroup FieldType = fieldType, FieldBoundTo = fieldBoundTo, IsActive = true, MandatoryStatus = mandatoryStatus, AvailableForCharacterGroupIds = await ValidateCharacterGroupList(projectId, showForGroups), IncludeInPrint = includeInPrint, ShowOnUnApprovedClaims = showForUnapprovedClaims }; CreateOrUpdateSpecialGroup(field); UnitOfWork.GetDbSet <ProjectField>().Add(field); await UnitOfWork.SaveChangesAsync(); }