コード例 #1
0
        static void Main(string[] args)
        {
            var cookieDough = new IceCream();

            cookieDough.IsCreamy = true;

            cookieDough.Noms();

            var lordOfTheRings = new Fantasy();

            lordOfTheRings.IsOld = false;

            lordOfTheRings.Read();

            var settlersOfCatan = new BoardGames();

            settlersOfCatan.IsLong = true;

            settlersOfCatan.Play();

            var husband = new Family();

            husband.IsPhillip = true;

            husband.Hello();

            Console.ReadKey();
        }
コード例 #2
0
        public IActionResult Privacy()
        {
            var myFantasy = new Fantasy
            {
                Year   = 2012,
                Title  = "Dragon's Breath",
                Author = "Sam Goldsman",
                NumberOfBooksInSeries = 3
            };

            _bookRepo.Add(myFantasy);

            return(View(myFantasy));
        }
コード例 #3
0
        public async Task <ActionResult <FantasyDto> > CreateFantasy(int userId, CreateFantasyDto createFantasyDto)
        {
            var fantasy = new Fantasy
            {
                ActionOf = createFantasyDto.ActionOf,
                DoAction = (IPlanAction.ActionType)createFantasyDto.DoAction,
                Strength = createFantasyDto.Strength,
                ToWhat   = createFantasyDto.ToWhat,
                Type     = (IPlanAction.ReactionType)createFantasyDto.Type,
                User     = await _unitOfWork.UserRepository.GetUserByIdAsync(userId)
            };

            _unitOfWork.FantasyRepository.AddItem(fantasy);
            if (await _unitOfWork.Complete())
            {
                return(Ok(_mapper.Map <FantasyDto>(fantasy)));
            }

            return(BadRequest("Unable to create Fantasy"));
        }