示例#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
        public ActionResult Create(AskCreateViewModel askCreateViewModel)
        {
            var askServiceClient = new AskServiceClient();

            askServiceClient.Save(askCreateViewModel.Ask);

            return(RedirectToAction("Index"));
        }