public ActionResult ProductTypeIndex(int id)//NatureId { var producttype = new ProductTypeService(_unitOfWork).GetProductTypeListForMaterial(id).ToList(); if (producttype.Count() == 0) { ViewBag.PrevLink = Request.UrlReferrer.ToString(); ViewBag.Message = "No ProductType found for this section."; return(View("~/Views/Shared/NotFound.cshtml")); } if (producttype.Count() == 1) { return(RedirectToAction("MaterialIndex", new { id = producttype.FirstOrDefault().ProductTypeId })); } else { return(View("ProductTypeIndexForMaterial", producttype)); } }