Ejemplo n.º 1
0
 public async void MakeBuilding(MappingViewModel mvmBuilding)
 {
     Building building = new Building { buildingName = mvmBuilding.building.buildingName };
     if (ModelState.IsValid)
     {
         db.Building.Add(building);
         await db.SaveChangesAsync();
     }
     AddRowsToBuilding(mvmBuilding, building);
 }
Ejemplo n.º 2
0
 private async void AddRowsToBuilding(MappingViewModel mvmCount, Building building)
 {
     for (int i = mvmCount.countHolder; i > 0; i--)
     {
         Row row = new Row { Building = building };
         if (ModelState.IsValid)
         {
             db.Row.Add(row);
             await db.SaveChangesAsync();
         }
     }
 }
Ejemplo n.º 3
0
 // POST: CreateBuilding
 public async Task<ActionResult> CreateBuilding(MappingViewModel mvmItem)
 {
     Building building = new Building { buildingName = mvmItem.building.buildingName };
     Dock dock = new Dock { Building = building };
     if (ModelState.IsValid)
     {
         db.Building.Add(building);
         db.Dock.Add(dock);
         await db.SaveChangesAsync();
     }
     for (int i = mvmItem.countHolder; i > 0; i--)
     {
         Row row = new Row { Building = building, rowNumber = i };
         if (ModelState.IsValid)
         {
             db.Row.Add(row);
             await db.SaveChangesAsync();
         }
     }
     return RedirectToAction("BuildingDetail", new { id = building.buildingID });
 }