public ActionResult Edit(int?id) { var retVal = new ResourceVm { Success = false, Message = "" }; if (id <= 0) { retVal.Message = "Please provide an id."; // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); return(PartialView("Partial/_resourceEditPartial", retVal)); } var result = _resourceService.Find(id); if (result != null) { retVal.Success = true; retVal.Resource = result.ConvertToViewModel(); } else { retVal.Message = "Item with requested Id was not found."; } return(PartialView("Partial/_resourceEditPartial", retVal)); }