public ActionResult Edit(int id) { DetailDTO det = detailService.GetDetailById(id); Mapper.Initialize(cfg => cfg.CreateMap <DetailDTO, DetailViewModel>()); var detailview = Mapper.Map <DetailDTO, DetailViewModel>(det); if (detailview != null) { GetSelectListStockmen(); return(PartialView(detailview)); } return(View("Index")); }