コード例 #1
0
        void ActionAddAward()
        {
            ConsoleKey Key;
            Award      NewAward = new Award();
            string     Answer;

            do
            {
                Answer = TextAddAward();
                try
                {
                    NewAward = Award.Parse(BLL.GetAllAwards(), Answer);
                    PrintAwardData(NewAward);
                    BLL.AddAward(NewAward);
                    Console.WriteLine("Succsessfully added");
                }
                catch (ArgumentException e)
                {
                    Console.WriteLine(e.Message);
                }
                finally
                {
                    Console.WriteLine("Try again? (Press <<Y>>)");
                    Key = Console.ReadKey().Key;
                }
            } while (Key != ConsoleKey.Escape);
        }
コード例 #2
0
        public void CreateNewAward()
        {
            Console.WriteLine("Please insert title for create new award");
            string title = Console.ReadLine();

            //validation title and bla-bla-bla if it's okay:
            _awardLogic.AddAward(title);
        }
コード例 #3
0
 public IHttpActionResult AddAward([FromBody] AwardDTO award)
 {
     if (_bll.AddAward(award))
     {
         return(Ok());
     }
     return(InternalServerError());
 }