public ActionResult Edit(int?id) { if (!caSession.AuthoriseSession()) { return(Redirect((string)Session["ErrorUrl"])); } var model = new MarketViewModel(); if (id.HasValue && id > 0) { model = _marketServices.GetMarketById(id.Value); } return(View("_CreateEdit", model)); }