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); }
public ActionResult Create(AskCreateViewModel askCreateViewModel) { var askServiceClient = new AskServiceClient(); askServiceClient.Save(askCreateViewModel.Ask); return(RedirectToAction("Index")); }