Пример #1
0
        public async Task <IActionResult> PutBuildingDetails(long id, BuildingDetails buildingDetails)
        {
            if (id != buildingDetails.Id)
            {
                return(BadRequest());
            }

            _context.Entry(buildingDetails).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BuildingDetailsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #2
0
        public ActionResult GetBuildingDetails(int buildingId)
        {
            Building        building        = db.Building.Find(buildingId);
            BuildingDetails buildingDetails = new BuildingDetails();

            buildingDetails.BuildingId   = building.Id;
            buildingDetails.BuildingName = building.BuildingName;
            buildingDetails.BuildingPics = building.BuildingPics.Substring(0, building.BuildingPics.Length - 1).Split(' ');
            for (int i = 0; i < buildingDetails.BuildingPics.Length; i++)
            {
                buildingDetails.BuildingPics[i] = ConfigurationManager.AppSettings["ResourceUrl"] + buildingDetails.BuildingPics[i];
            }
            buildingDetails.BuildingIntro     = building.BuildingIntro;
            buildingDetails.BuildingAD        = building.BuildingAD;
            buildingDetails.BuildingAroundPic = ConfigurationManager.AppSettings["ResourceUrl"] + building.BuildingCate;
            buildingDetails.BuildingDeco      = building.BuildingDecorate;
            List <Layout>         layoutList         = db.Layout.Where(item => item.BuildingId == buildingId).ToList();
            List <BuildingLayout> buildingLayoutList = new List <BuildingLayout>();

            foreach (Layout layout in layoutList)
            {
                BuildingLayout buildingLayout = new BuildingLayout();
                buildingLayout.LayoutId   = layout.Id;
                buildingLayout.LayoutName = layout.LayoutName;
                buildingLayout.LayoutPic  = ConfigurationManager.AppSettings["ResourceUrl"] + layout.LayoutPic;
                buildingLayoutList.Add(buildingLayout);
            }
            buildingDetails.BuildingLayout = buildingLayoutList;
            return(Json(new { data = buildingDetails }, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public async Task <ActionResult <BuildingDetails> > PostBuildingDetails(BuildingDetails buildingDetails)
        {
            _context.BuildingDetails.Add(buildingDetails);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetBuildingDetails", new { id = buildingDetails.Id }, buildingDetails));
        }
Пример #4
0
        public override void ClearAllIsModified()
        {
            base.ClearAllIsModified();

            if (Pricing != null)
            {
                Pricing.ClearAllIsModified();
            }
            IsPricingModified = false;

            if (RuralFeatures != null)
            {
                RuralFeatures.ClearAllIsModified();
            }
            IsRuralFeaturesModified = false;

            if (BuildingDetails != null)
            {
                BuildingDetails.ClearAllIsModified();
            }
            IsBuildingDetailsModified = false;

            IsCategoryTypeModified = false;
            IsAuctionOnModified    = false;
            IsCouncilRatesModified = false;
        }
        public async Task <BuildingDetails> Insert(BuildingDetails details)
        {
            var building = _mapper.Map <BuildingDetails, Building>(details);

            await _context.Buildings.AddAsync(building);

            await _context.SaveChangesAsync();

            return(_mapper.Map <BuildingDetails>(building));
        }
Пример #6
0
 public async Task <ActionResult <BuildingDetails> > Put(BuildingDetails details)
 {
     try
     {
         return(await _buildingService.Update(details));
     }
     catch (BuildingDoesNotExistException e)
     {
         return(NotFound());
     }
 }
Пример #7
0
        public static void AssertBuildingDetails(BuildingDetails source,
                                                 BuildingDetails destination)
        {
            if (source == null &&
                destination == null)
            {
                return;
            }

            UnitOfMeasureAssertHelpers.AssertUnitOfMeasure(source.Area, destination.Area);
            source.EnergyRating.ShouldBe(destination.EnergyRating);
        }
        public async Task <BuildingDetails> Update(BuildingDetails details)
        {
            var building = await _context.Buildings.FirstOrDefaultAsync(b => b.Id == details.Id);

            if (building == null)
            {
                throw new BuildingDoesNotExistException(details.Id);
            }

            _mapper.Map <BuildingDetails, Building>(details, building);
            await _context.SaveChangesAsync();

            return(_mapper.Map <BuildingDetails>(building));
        }
Пример #9
0
    public void BuildingUpgarde()
    {
        BuildingDetails det = GameArgs.FocusBuilding.GetDetails <BuildingDetails>();

        if (det.Level < 10 && GameArgs.Gold >= det.UpgradeCost)
        {
            GameArgs.Gold -= det.UpgradeCost;
            det.Upgrade();
            GameArgs.World.GetComponent <World>().FX_Apply.PlayIfNotPlaying();
            UpgradeEffect();
        }
        else
        {
            GameArgs.World.GetComponent <World>().FX_Cancel.PlayIfNotPlaying();
        }
    }
Пример #10
0
        public void GivenAnAreaWithAMissingType_Validate_ShouldNotHaveAValidationError()
        {
            // Arrange.
            var buildingDetails = new BuildingDetails
            {
                Area = new UnitOfMeasure
                {
                    Type  = null,
                    Value = 1m
                }
            };

            // Act.
            _buildingDetailsValidator.ShouldHaveChildValidator(building => building.Area, typeof(UnitOfMeasureValidator));
            var errors = _buildingDetailsValidator.Validate(buildingDetails);

            // Assert.
            errors.Errors.Count.ShouldBe(1);
        }
Пример #11
0
    //Finalize building
    void PlaceNewBuilding()
    {
        GameObject newBuilding = Instantiate(_BuildCheck._BuildingToSpawn, _BuildCheck.transform.position, _ContructionSphere.transform.rotation, _BuildingParent);

        Destroy(_BuildCheck._ConstructionBuilding);
        _BuildCheck._ConstructionBuilding = null;
        _ContructionSphere.gameObject.SetActive(false);

        _CanPlaceObject = false;
        _RotatingObject = false;

        if (_CurrentResources)
        {
            _CurrentResources._CollectedWood  -= _BuildingDetails._WoodCost;
            _CurrentResources._CollectedStone -= _BuildingDetails._StoneCost;
            _CurrentResources._CollectedFood  -= _BuildingDetails._FoodCost;
            _BuildingDetails = null;
        }
    }
Пример #12
0
        public override void ClearAllIsModified()
        {
            base.ClearAllIsModified();

            if (BuildingDetails != null)
            {
                BuildingDetails.ClearAllIsModified();
            }
            IsBuildingDetailsModified = false;

            if (Pricing != null)
            {
                Pricing.ClearAllIsModified();
            }
            IsPricingModified = false;

            IsPropertyTypeModified = false;
            IsAvailableOnModified  = false;
        }
        public void Copy(RuralListing newRuralListing)
        {
            if (newRuralListing == null)
            {
                throw new ArgumentNullException("newRuralListing");
            }

            base.Copy(newRuralListing);

            if (newRuralListing.IsCategoryTypeModified)
            {
                CategoryType = newRuralListing.CategoryType;
            }

            if (newRuralListing.IsPricingModified)
            {
                if (newRuralListing.Pricing == null)
                {
                    Pricing = null;
                }
                else
                {
                    if (Pricing == null)
                    {
                        Pricing = new SalePricing();
                    }

                    if (newRuralListing.Pricing.IsModified)
                    {
                        Pricing.Copy(newRuralListing.Pricing);
                    }

                    IsPricingModified = true;
                }
            }

            if (newRuralListing.IsAuctionOnModified)
            {
                AuctionOn = newRuralListing.AuctionOn;
            }

            if (newRuralListing.IsRuralFeaturesModified)
            {
                if (newRuralListing.RuralFeatures == null)
                {
                    RuralFeatures = null;
                }
                else
                {
                    if (RuralFeatures == null)
                    {
                        RuralFeatures = new RuralFeatures();
                    }

                    if (newRuralListing.RuralFeatures.IsModified)
                    {
                        RuralFeatures.Copy(newRuralListing.RuralFeatures);
                    }

                    IsRuralFeaturesModified = true;
                }
            }

            if (newRuralListing.IsCouncilRatesModified)
            {
                CouncilRates = newRuralListing.CouncilRates;
            }

            if (newRuralListing.IsBuildingDetailsModified)
            {
                if (newRuralListing.BuildingDetails == null)
                {
                    BuildingDetails = null;
                }
                else
                {
                    if (BuildingDetails == null)
                    {
                        BuildingDetails = new BuildingDetails();
                    }

                    if (newRuralListing.BuildingDetails.IsModified)
                    {
                        BuildingDetails.Copy(newRuralListing.BuildingDetails);
                    }

                    IsBuildingDetailsModified = true;
                }
            }
        }
Пример #14
0
        public void Copy(ResidentialListing newResidentialListing)
        {
            if (newResidentialListing == null)
            {
                throw new ArgumentNullException("newResidentialListing");
            }

            if (!newResidentialListing.IsModified)
            {
                return;
            }

            base.Copy(newResidentialListing);

            if (newResidentialListing.IsPropertyTypeModified)
            {
                PropertyType = newResidentialListing.PropertyType;
            }

            if (newResidentialListing.IsPricingModified)
            {
                if (newResidentialListing.Pricing == null)
                {
                    Pricing = null;
                }
                else
                {
                    if (Pricing == null)
                    {
                        Pricing = new SalePricing();
                    }

                    if (newResidentialListing.Pricing.IsModified)
                    {
                        Pricing.Copy(newResidentialListing.Pricing);
                    }

                    IsPricingModified = true;
                }
            }

            if (newResidentialListing.IsAuctionOnModified)
            {
                AuctionOn = newResidentialListing.AuctionOn;
            }

            if (newResidentialListing.IsCouncilRatesModified)
            {
                CouncilRates = newResidentialListing.CouncilRates;
            }

            if (newResidentialListing.IsBuildingDetailsModified)
            {
                if (newResidentialListing.BuildingDetails == null)
                {
                    BuildingDetails = null;
                }
                else
                {
                    if (BuildingDetails == null)
                    {
                        BuildingDetails = new BuildingDetails();
                    }

                    if (newResidentialListing.BuildingDetails.IsModified)
                    {
                        BuildingDetails.Copy(newResidentialListing.BuildingDetails);
                    }

                    IsBuildingDetailsModified = true;
                }
            }
        }
Пример #15
0
 public void SetMostRecentBuildOrder(BuildingDetails a_buldingDetails)
 {
     _BuildingDetails = a_buldingDetails;
 }
Пример #16
0
 public async Task <ActionResult <BuildingDetails> > Post(BuildingDetails details)
 {
     return(await _buildingService.Insert(details));
 }
        public void Copy(RentalListing newRentalListing)
        {
            if (newRentalListing == null)
            {
                throw new ArgumentNullException("newRentalListing");
            }

            base.Copy(newRentalListing);

            if (newRentalListing.IsPropertyTypeModified)
            {
                PropertyType = newRentalListing.PropertyType;
            }

            if (newRentalListing.IsAvailableOnModified)
            {
                AvailableOn = newRentalListing.AvailableOn;
            }

            if (newRentalListing.IsPricingModified)
            {
                if (newRentalListing.Pricing == null)
                {
                    Pricing = null;
                }
                else
                {
                    if (Pricing == null)
                    {
                        Pricing = new RentalPricing();
                    }

                    if (newRentalListing.Pricing.IsModified)
                    {
                        Pricing.Copy(newRentalListing.Pricing);
                    }

                    IsPricingModified = true;
                }
            }

            if (newRentalListing.IsBuildingDetailsModified)
            {
                if (newRentalListing.BuildingDetails == null)
                {
                    BuildingDetails = null;
                }
                else
                {
                    if (BuildingDetails == null)
                    {
                        BuildingDetails = new BuildingDetails();
                    }

                    if (newRentalListing.BuildingDetails.IsModified)
                    {
                        BuildingDetails.Copy(newRentalListing.BuildingDetails);
                    }

                    IsBuildingDetailsModified = true;
                }
            }
        }
Пример #18
0
        public void Copy(RuralListing newRuralListing)
        {
            if (newRuralListing == null)
            {
                throw new ArgumentNullException("newRuralListing");
            }

            base.Copy(newRuralListing);

            if (newRuralListing.IsCategoryTypeModified)
            {
                CategoryType = newRuralListing.CategoryType;
            }

            if (newRuralListing.IsPricingModified)
            {
                if (newRuralListing.Pricing == null)
                {
                    Pricing = null;
                }
                else
                {
                    if (Pricing == null)
                    {
                        Pricing = new SalePricing();
                    }

                    if (newRuralListing.Pricing.IsModified)
                    {
                        Pricing.Copy(newRuralListing.Pricing);
                    }

                    IsPricingModified = true;
                }
            }

            if (newRuralListing.IsAuctionOnModified)
            {
                AuctionOn = newRuralListing.AuctionOn;
            }

            if (newRuralListing.IsRuralFeaturesModified)
            {
                if (newRuralListing.RuralFeatures == null)
                {
                    RuralFeatures = null;
                }
                else
                {
                    if (RuralFeatures == null)
                    {
                        RuralFeatures = new RuralFeatures();
                    }

                    if (newRuralListing.RuralFeatures.IsModified)
                    {
                        RuralFeatures.Copy(newRuralListing.RuralFeatures);
                    }

                    IsRuralFeaturesModified = true;
                }
            }

            if (newRuralListing.IsCouncilRatesModified)
            {
                CouncilRates = newRuralListing.CouncilRates;
            }

            if (newRuralListing.IsBuildingDetailsModified)
            {
                if (newRuralListing.BuildingDetails == null)
                {
                    BuildingDetails = null;
                }
                else
                {
                    if (BuildingDetails == null)
                    {
                        BuildingDetails = new BuildingDetails();
                    }

                    if (newRuralListing.BuildingDetails.IsModified)
                    {
                        BuildingDetails.Copy(newRuralListing.BuildingDetails);
                    }

                    IsBuildingDetailsModified = true;
                }
            }
        }
Пример #19
0
 /// <summary>
 /// 初始化
 /// </summary>
 protected override void Awake()
 {
     _details = new BuildingDetails(Identify);
     base.Awake();
 }
Пример #20
0
        public void SetTemporaryBuilding(BuildingDetails toBuild)
        {
            var temporary = GameObject.Instantiate(toBuild.Prefab, Vector3.zero, Quaternion.identity);

            temporaryBuild = temporary;
        }
Пример #21
0
        public void Copy(RentalListing newRentalListing)
        {
            if (newRentalListing == null)
            {
                throw new ArgumentNullException("newRentalListing");
            }

            base.Copy(newRentalListing);

            if (newRentalListing.IsPropertyTypeModified)
            {
                PropertyType = newRentalListing.PropertyType;
            }

            if (newRentalListing.IsAvailableOnModified)
            {
                AvailableOn = newRentalListing.AvailableOn;
            }

            if (newRentalListing.IsPricingModified)
            {
                if (newRentalListing.Pricing == null)
                {
                    Pricing = null;
                }
                else
                {
                    if (Pricing == null)
                    {
                        Pricing = new RentalPricing();
                    }

                    if (newRentalListing.Pricing.IsModified)
                    {
                        Pricing.Copy(newRentalListing.Pricing);
                    }

                    IsPricingModified = true;
                }
            }

            if (newRentalListing.IsBuildingDetailsModified)
            {
                if (newRentalListing.BuildingDetails == null)
                {
                    BuildingDetails = null;
                }
                else
                {
                    if (BuildingDetails == null)
                    {
                        BuildingDetails = new BuildingDetails();
                    }

                    if (newRentalListing.BuildingDetails.IsModified)
                    {
                        BuildingDetails.Copy(newRentalListing.BuildingDetails);
                    }

                    IsBuildingDetailsModified = true;
                }
            }
        }