public PartyEntity Post([FromBody] PartyEntity partyEntity)
        {
            partyService
            .CreateParty(partyEntity);

            return(partyEntity);
        }
Ejemplo n.º 2
0
        public IActionResult CreateParty([FromBody] PartyDto partyDto)
        {
            try
            {
                _partyService.CreateParty(partyDto);
            }catch (Exception e)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }

            return(StatusCode(StatusCodes.Status200OK));
        }
Ejemplo n.º 3
0
        public ActionResult Create(CreatePartyViewModel vm)
        {
            var citizen         = SessionHelper.LoggedCitizen;
            var country         = citizen.Region.Country;
            var countryPolicies = country.CountryPolicy;
            var countryCurrency = country.Currency;
            var configuration   = ConfigurationHelper.Configuration;

            var validator = new PartyCreateValidator(ModelState, entityService);


            var countryFee = new MoneyViewModel(countryCurrency, countryPolicies.PartyFoundingFee);
            var adminFee   = new MoneyViewModel(GameHelper.Gold, configuration.PartyFoundingFee);

            if (validator.IsValid)
            {
                var party = partyService.CreateParty(vm.Name, citizen, country);

                var adminMoney = new Money()
                {
                    Amount   = adminFee.Quantity,
                    Currency = GameHelper.Gold
                };

                var countryMoney = new Money()
                {
                    Amount   = countryFee.Quantity,
                    Currency = countryCurrency
                };

                var adminTransaction = new Transaction()
                {
                    Arg1 = "Admin Fee",
                    Arg2 = string.Format("{0}({1}) created party {2}({3})", citizen.Entity.Name, citizen.Entity.EntityID, party.Entity.Name, party.ID),
                    DestinationEntityID = null,
                    Money           = adminMoney,
                    SourceEntityID  = citizen.Entity.EntityID,
                    TransactionType = TransactionTypeEnum.PartyCreate
                };
                var countryTransaction = new Transaction()
                {
                    Arg1 = "Country Fee",
                    Arg2 = adminTransaction.Arg2,
                    DestinationEntityID = country.ID,
                    Money           = countryMoney,
                    SourceEntityID  = citizen.Entity.EntityID,
                    TransactionType = TransactionTypeEnum.PartyCreate
                };

                transactionService.MakeTransaction(adminTransaction);
                transactionService.MakeTransaction(countryTransaction);

                AddMessage(new PopupMessageViewModel(string.Format("Party {0} was created!", party.Entity.Name)));
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                RedirectBack();
            }



            vm.CountryFee = countryFee;
            vm.AdminFee   = adminFee;

            return(View(vm));
        }
Ejemplo n.º 4
0
        public IHttpActionResult CreateParty(string name)
        {
            var createdParty = partyService.CreateParty(name);

            return(Ok(createdParty));
        }