public void AddPagesService(PagesDTO entity)
        {
            Pages pages = new Pages
            {
                Pagetitle       = entity.Pagetitle,
                PageDescription = entity.PageDescription,
                Photo           = entity.Photo,
                PageUrl         = entity.PageUrl
            };

            pagesRepository.Add(pages);
        }
コード例 #2
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var model = new PageModel();
                UpdateModel(model);

                var entity = new Page {Monitor = model.Monitor, Url = model.Url};

                using (var repo = new PagesRepository())
                {
                    repo.Add(entity);
                    repo.SaveChanges();
                }

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #3
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var model = new PageModel();
                UpdateModel(model);

                var entity = new Page {
                    Monitor = model.Monitor, Url = model.Url
                };

                using (var repo = new PagesRepository())
                {
                    repo.Add(entity);
                    repo.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #4
0
        public void KeyPressed(ConsoleKeyInfo key)
        {
            if (!IsActive)
            {
                return;
            }

            switch (key.Key)
            {
            case ConsoleKey.Escape:
                NavigateBack();
                return;

            case ConsoleKey.Tab:
                if (key.Modifiers == ConsoleModifiers.Shift)
                {
                    NavigateBack();
                }
                else
                {
                    NavigateForward();
                }
                return;

            case ConsoleKey.Enter:
                NavigateForward();
                return;



            case ConsoleKey.F7:
                new EnterNameWindow
                {
                    Header = "Enter page name"
                }
                .SubscribeOnEnter((_, value) =>
                {
                    PagesRepository.Add(_activeNoteBook.Id, value);
                    ActivePageChanged();
                })
                .ShowModalWindow();

                return;


            case ConsoleKey.F2:
                StateKeeper.StateHasToBeSynced();
                return;


            case ConsoleKey.F4:
                var selectedPage = GetSelectedPage();
                if (selectedPage != null)
                {
                    new EnterNameWindow
                    {
                        Context = selectedPage,
                        Header  = "Edit notebook name",
                    }
                }
                .SetValue(selectedPage.Name)
                .SubscribeOnEnter((ctx, value) =>
                {
                    var page = (Page)ctx;
                    PagesRepository.Update(_activeNoteBook.Id, page.Id, value);
                    ActivePageChanged();
                })
                .ShowModalWindow();
                return;