コード例 #1
0
        public static AskViewModel Build(AskViewsEnum askViewsEnum, AskServiceClient askServiceClient)
        {
            AskViewModel model = null;

            switch (askViewsEnum)
            {
            case AskViewsEnum.Index:
                model = new AskIndexViewModel {
                    Asks = askServiceClient.Get()
                };
                break;

            case AskViewsEnum.Create:
                model = new AskCreateViewModel
                {
                    Title = "Throw a Bone!!",
                    Ask   = new Ask()
                    {
                        DateCreated = DateTime.UtcNow
                    }
                };
                break;
            }

            return(model);
        }
コード例 #2
0
ファイル: AskController.cs プロジェクト: larrydanna/fetchr
        public ActionResult Create(AskCreateViewModel askCreateViewModel)
        {
            var askServiceClient = new AskServiceClient();

            askServiceClient.Save(askCreateViewModel.Ask);

            return(RedirectToAction("Index"));
        }