public async Task <ActionResult <formation> > PostFormation(formation formationBody) { /// <summary> /// Create a new formation /// </summary> _context.formations.Add(formationBody); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetFormation), new { id = formationBody.id }, formationBody)); }
public async Task <ActionResult <formation> > GetFormation(Guid id) { /// <summary> /// Get a specific formation by is ID /// </summary> /// <returns>Return the formation information</returns> formation formationResult = await _context.formations.FindAsync(id); if (formationResult == null) { return(NotFound()); } return(formationResult); }
public async Task <ActionResult <formation> > PutFormation(Guid id, formation formationPut) { /// <summary> /// Update the formation specific by is ID /// </summary> formationPut.id = id; if (!FormationExists(id)) { return(NotFound()); } _context.Entry(formationPut).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { throw; } return(StatusCode(200)); }
public static void InsertNewFormation(String nom, String description, String dateDebut, String dateFin, String etablissement, Guid userId) { bindedinEntities bie = SingletonEntities.Instance; var existingFormation = from f in bie.formations from s in bie.schools where f.name.Equals(nom) where f.school.Equals(s.id) where s.name.Equals(etablissement) select f; if (existingFormation.Count() == 0) { formation ord = new formation { name = nom, description = description, school = Business.SchoolsService.InsertSchool(etablissement, ""), }; bie.formations.AddObject(ord); bie.SaveChanges(); } var idFormation = from f in bie.formations where f.name.Equals(nom) where f.description.Equals(description) select f.id; user_formation uf = new user_formation { user = userId, formation = idFormation.First(), beginning_date = DateTime.Parse(dateDebut, CultureInfo.CreateSpecificCulture("en-US")), end_date = DateTime.Parse(dateFin, CultureInfo.CreateSpecificCulture("en-US")), }; bie.user_formation.AddObject(uf); bie.SaveChanges(); }
private Task CreateDemoFormations(IServiceProvider serviceProvider) { if (!Configuration.GetSection("DemoFormations").Exists()) { return(Task.CompletedTask); } var dbContext = serviceProvider.GetRequiredService <DbContextMediwatch>(); foreach (var DemoConf in Configuration.GetSection("DemoFormations").GetChildren()) { IQueryable <formation> query = dbContext.formations; query = query.Where(e => e.Name.Contains(DemoConf["Name"])); var resultSearch = query.ToList(); if (resultSearch.Any()) { continue; } var form = new formation { Name = DemoConf["Name"], Description = DemoConf["Description"], Former = DemoConf["Former"], Target = DemoConf["Target"], OrganizationName = DemoConf["OrganizationName"], Location = DemoConf["Location"], Price = decimal.Parse(DemoConf["Price"]), StartDate = DateTime.Parse(DemoConf["StartDate"]), EndDate = DateTime.Parse(DemoConf["EndDate"]), }; dbContext.formations.Add(form); } return(dbContext.SaveChangesAsync()); }
public static string selectedSlotName; //선택된 인벤토리 슬롯 이름 void Start() { isInventoryClicked = 0; // 초기 포메이션 설정 guideFormation[0] = new formation("4-1", -1.1f, -0.1f, -0.4f, -0.1f, 0.4f, -0.1f, 1.1f, -0.1f, 0f, -0.8f); guideFormation[1] = new formation("3-2", -0.7f, -0.1f, 0.0f, -0.1f, 0.7f, -0.1f, -0.4f, -0.8f, 0.4f, -0.8f); guideFormation[2] = new formation("2-1-2", -0.8f, -0.1f, 0.8f, -0.1f, 0f, -0.5f, -0.8f, -0.8f, 0.8f, -0.8f); guideFormation[3] = new formation("2-3", -0.4f, -0.1f, 0.4f, -0.1f, -0.7f, -0.8f, 0f, -0.8f, 0.7f, -0.8f); guideFormation[4] = new formation("1-4", 0.0f, -0.1f, -1.1f, -0.8f, -0.4f, -0.8f, 0.4f, -0.8f, 1.1f, -0.8f); // 설정할 팀 로드 gameManager = GameObject.Find("GameManager"); gameManagerScript = gameManager.GetComponent <GameManagerScript>(); if (SceneManager.GetActiveScene().name == "TeamSettingScene") { setTeam = gameManagerScript.myTeam; } else { setTeam = gameManagerScript.comTeam; } for (int i = 0; i < MAXPLAYERS; i++) { players[i].GetComponent <SpriteRenderer>().color = setTeam.teamColor; players[i].GetComponent <PlayerSetting>().myColor = setTeam.teamColor; } formationName.GetComponent <Text>().text = guideFormation[formationIndex].name; for (int i = 0; i < MAXPLAYERS; i++) { players[i].transform.localPosition = new Vector3(guideFormation[formationIndex].positions[i].x, guideFormation[formationIndex].positions[i].y); } GameObject.Find("Background").GetComponent <SpriteRenderer>().color = setTeam.teamColor; ResetButtonClick(); }