ViewModel for the Title class
Example #1
0
        public static TitleViewModel Create(IRepository repository)
        {
            Check.Require(repository != null, "Repository must be supplied");

            var viewModel = new TitleViewModel {
                Title = new Title()
            };

            return(viewModel);
        }
Example #2
0
        public ActionResult Create(Title title)
        {
            var titleToCreate = new Title();

            TransferValues(title, titleToCreate);

            if (ModelState.IsValid)
            {
                RepositoryFactory.TitleRepository.EnsurePersistent(titleToCreate);

                Message = "Title Created Successfully";

                return(RedirectToAction("Index"));
            }
            else
            {
                var viewModel = TitleViewModel.Create(Repository);
                viewModel.Title = title;

                return(View(viewModel));
            }
        }
Example #3
0
        public static TitleViewModel Create(IRepository repository)
        {
            Check.Require(repository != null, "Repository must be supplied");

            var viewModel = new TitleViewModel {Title = new Title()};

            return viewModel;
        }
Example #4
0
        //
        // GET: /Admin/Title/Create
        public ActionResult Create()
        {
            var viewModel = TitleViewModel.Create(Repository);

            return(View(viewModel));
        }