public PlaybookData Find(int id) { PlaybookData data = _context.PlaybookData.Include(_ => _.CreateUserData).Include(__ => __.LastUpdateUserData).AsNoTracking().FirstOrDefault(m => m.PlaybookSystemId == id); data.CategoryData = _context.CategoryData.FirstOrDefault(_ => _.Code == data.Category); return(data); }
public void ChangePlaybook(PlaybookData data, IFormFile file, User updateUser) { ChangeInstallStatus(data.IntroduceStatus); ChangeCategory(new Category(data.Category)); ChangePlayName(new PlayName(data.PlayFullName, data.PlayShortName, data.PlayCallName)); ChangePlayDesign(file); ChangeContext(new Context(data.Context)); ChangeLastUpdateUser(updateUser, DateTime.Now); }
public CreateModel(IPlaybookRepository playbookRepository) { _playbookService = new PlaybookService(playbookRepository); IList <Category> categories = _playbookService.GetCategoryList("Offense"); _sessionService = new SessionService(); CaterogyList = new SelectList(categories, "Code", "Name"); StatusList = InstallSatusService.GetSelectList(); PlaybookData = new PlaybookData(); }
public async Task Edit(PlaybookData data) { _context.Attach(data).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateException ex) { throw new ISSRepositoryException("Playbookのデータベースへの更新処理でエラーが発生しました。", ex); } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } PlaybookData = await _context.PlaybookData.FirstOrDefaultAsync(m => m.PlaybookSystemId == id); if (PlaybookData == null) { return(NotFound()); } return(Page()); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, PlaybookData playbookData) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); var githubLoadTask = playbookData.LoadFromGithub(new GitHubConfig(Configuration, loggerFactory), loggerFactory); githubLoadTask.Wait(); app.UseMiddleware <ExceptionHandler>(); app.UseAuthentication(); app.UseSession(); app.UseMvc(); }
public async Task <IActionResult> OnGetAsync(int?id) { LoginUser = _sessionService.GetLoginUser(HttpContext); if (LoginUser == null) { return(RedirectToPage("/Login")); } if (id == null) { return(NotFound()); } PlaybookData = await _context.PlaybookData.FirstOrDefaultAsync(m => m.PlaybookSystemId == id); if (PlaybookData == null) { return(NotFound()); } return(Page()); }
public PlaybookData ToData() { PlaybookData data = new PlaybookData(); data.PlaybookSystemId = PlaybookSystemId; data.PlaybookId = PlaybookId; //data.OffenseFormationId = OffenseFormation.PlayFormationId; //data.DefenceFormationId = DefenceFormation.PlayFormationId; data.PlayFullName = PlayName.FullName; data.PlayShortName = PlayName.ShortName; data.PlayCallName = PlayName.PlayCall; data.Category = Category.Code; data.IntroduceStatus = InstallStatus; data.PlayDesignUrl = PlayDesign.Url; data.Context = Context.Text; data.CreateUserId = CreateUser.UserId; data.CreateDate = CreateDate; data.LastUpdateUserId = LastUpdateUser.UserId; data.LastUpdateDate = LastUpdateDate; return(data); }
public async Task <IActionResult> OnPostAsync(int?id) { LoginUser = _sessionService.GetLoginUser(HttpContext); if (LoginUser == null) { return(RedirectToPage("/Login")); } if (id == null) { return(NotFound()); } PlaybookData = await _context.PlaybookData.FindAsync(id); if (PlaybookData != null) { _context.PlaybookData.Remove(PlaybookData); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { ConfigureAuth(services, Configuration); services.AddSession(); services.AddSingleton <IActionContextAccessor, ActionContextAccessor>(); services.AddScoped <IUrlHelper, UrlHelper>(iFactory => new UrlHelper(iFactory.GetService <IActionContextAccessor>().ActionContext) ); services.AddMvc(options => { options.OutputFormatters.Insert(0, new PartialSerializedJsonOutputFormatter( new MvcJsonOptions().SerializerSettings, ArrayPool <char> .Shared)); }); services .AddAuthentication(authOptions => { authOptions.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; authOptions.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }) .AddJwtBearer(jwtOptions => { jwtOptions.Authority = String.Format(CultureInfo.InvariantCulture, Configuration["AzureAd:AadInstance"], Configuration["AzureAd:Tenant"]); jwtOptions.Audience = Configuration["ClientId"]; jwtOptions.SaveToken = true; }); var playbookData = new PlaybookData(); playbookData.RegisterData(services); services.AddMediatR(typeof(GetEventTypeRequest).GetTypeInfo().Assembly); }
/// <summary> /// プレイブックの新規登録 /// </summary> /// <remarks>プレイデザイン画像があった場合、AWS S3に保存される。</remarks> /// <param name="playbook"></param> /// <param name="bucketPath"></param> public async Task Add(PlaybookData data) { _context.PlaybookData.Add(data); await _context.SaveChangesAsync(); }
public Playbook(PlaybookData data, IFormFile file, User createUser) : this(data.PlaybookId, new Category(data.Category), new PlayName(data.PlayFullName, data.PlayShortName, data.PlayCallName), data.IntroduceStatus, file, new Context(data.Context), createUser) { }