public async Task <IActionResult> UpdateFamily(int id, [FromBody] Family family) { if (!ModelState.IsValid) { return(BadRequest(ModelState.Values)); } if (id != family.FamilyId) { return(BadRequest(ErrorMessageContracts.MismatchedId)); } var existing = await _context.Families.FindAsync(id); if (existing == null) { return(NotFound()); } FamilyHelper.UpdateFamily(existing, family); try { _context.Families.Update(existing); await _context.SaveChangesAsync(); } catch (Exception e) { Console.WriteLine(e.Message); return(StatusCode(StatusCodes.Status500InternalServerError)); } return(NoContent()); }
public void GetFamilyById_ReturnsFamilyWithId() { using (var context = new TestHedwigContextProvider().Context) { var family = FamilyHelper.CreateFamily(context); var familyRepo = new FamilyRepository(context); var res = familyRepo.GetFamilyById(family.Id); Assert.Equal(family.Id, res.Id); } }
public async Task UpdatedTemporalEntity_IsUpdated_OnSaveChangesAsync() { using (var context = new TestHedwigContextProvider().Context) { var family = FamilyHelper.CreateFamily(context); var updatedAt = family.UpdatedAt; context.Update(family); await context.SaveChangesAsync(); Assert.NotNull(family.AuthorId); Assert.NotNull(family.UpdatedAt); Assert.NotEqual(updatedAt, family.UpdatedAt); } }
public void GetDeterminationByFamilyId_ReturnsDeterminationsWithFamilyId() { using (var context = new TestHedwigContextProvider().Context) { // If a family determination exist with family Id var family = FamilyHelper.CreateFamily(context); var determination = FamilyDeterminationHelper.CreateDetermination(context, family: family); // When the repository is queried with a family Id var determinationRepo = new FamilyDeterminationRepository(context); var res = determinationRepo.GetDeterminationsByFamilyId(family.Id); // Then a list including only that determination is returned Assert.Single(res); Assert.Equal(determination.Id, res.First().Id); } }
private static Result placeTemporayShoring(UIDocument uiDoc) { Document _doc = uiDoc.Document; string _familyPathName = @"C:\$\AEC Hackathon 2020\AecHackathon2020_StructuralReshoring\Resources\2019 Families\EllisShore_LumberWithClamps.rfa"; var _familyDefinition = FamilyHelper.GetOrLoadFamilyDefinition(_doc, _familyPathName); //scale - 1" = 30' //hatches are typically standardized - governed by building code //Question: what determines clamp spacing? https://ellismanufacturing.com/pages/column-clamp-spacing-calculator //Question: how much "extra" lumber is needed, in addition to clamp spacing? 3.5" //Question: what is the logic behind placement/pour schedule order? By Level? Lowest Level to Highest Level? Heaviest Total Vertical Load to Lightest? //Question: what numbers are required for equipment selection? //Question: what building code info is needed? //Question: what room data is needed? //Question: what area data is needed? //Question: is there a "set" level count that we need concerned with? for example, is it "only the next 5 levels above" or is it "all levels above"? depends - it will be a varying X levels //Get: CAD, RVT, PDF "real" files //Get: CAD - read hatch patterns & key to understand //Get: families from Jason //ToDo: read input: level heights for all levels above - this will likely be a set number, based on the number of levels expected to be above the current level, while this level is drying //ToDo: read input: level static load (optional: Foundations, Snow Load, Seismic Load, etc) //ToDo: read input: level live load //ToDo: read input: floor density / weight per sqft / thickness //ToDo: read input: building code //ToDo: read input: room data //ToDo: read input: area data //ToDo: generate output: temporary shoring insertion points //ToDo: generate output: temporary shoring families placed; with parameters set // Total Shore Height // Lower Shore Member Length // Clamp Spacing // Type Name //ToDo: generate output: calculation numerical inputs & outputs (for equipment selection) //ToDo: generate output: placement schedule return(Result.Succeeded); }
/// <summary> /// NOT WORKING YET /// Generates flakeboard stripes objects from the given properties. /// </summary> /// <param name="props">Needed properties.</param> public static List <FamilyInstance> CreateFlakeboardStripesDirectly(FlakeboardStripesProperties props) { List <FS_Rectangle> allLines = CreateFlakeboardRectangles(props); List <FamilyInstance> allInstances = new List <FamilyInstance>(); foreach (var item in allLines) { allInstances.Add(FamilyHelper.Create( props.FlakeboardType, props.FloorData.Level, Point.ByCoordinates(item.CenterPosition.X, item.CenterPosition.Y, item.CenterPosition.Z), props.FlakeboardRotation, item.Length, item.Width )); } return(allInstances); }