예제 #1
0
        public dynamic SaveServant([FromBody] Servant servant)
        {
            var cc = new CreationCandidate <Servant>(servant);
            var validationResults = ServantCreationValidator.Validate(cc);

            if (validationResults.IsValid)
            {
                ServantRepository.SaveServant(servant);
                return(Ok("Servant Created"));
            }
            else
            {
                return(validationResults.Errors);
            }
        }
예제 #2
0
        public dynamic SaveMage([FromBody] Mage mage)
        {
            var cc = new CreationCandidate <Mage>(mage);
            var validationResults = MageCreationValidator.Validate(cc);

            if (validationResults.IsValid)
            {
                MageRepository.SaveMage(mage);
                return(Ok("Mage Created"));
            }
            else
            {
                return(validationResults.Errors);
            }
        }