public void Put(int id, [FromBody] BuildingFloorViewModel Floor) { //var building = _unitOfWork.Buildings.Get(Floor.buildingId); //var model = new BuildingFloor { id = Floor.id, Name = Floor.name, CurrentBuilding = building }; //_unitOfWork.BuildingFloor.Update(model); //_unitOfWork.SaveChanges(); }
public BuildingFloorViewModel Post([FromBody] BuildingFloorViewModel Floor) { var buildingEntrance = _unitOfWork.BuildingEntrance.Get(Floor.buildingEntranceId); var model = new BuildingFloor { id = Floor.id, Name = Floor.name, buildingEntrance = buildingEntrance }; _unitOfWork.BuildingFloor.Add(model); _unitOfWork.SaveChanges(); Floor.id = model.id; return(Floor); }