public IActionResult CreateDetail(PlanDetailViewModel model) { ViewBag.Plans = _planRepository.GetAllPlans(); if (ModelState.IsValid) { var planDetail = _mapper.Map <PlanDetailViewModel, PlanDetail>(model); planDetail.AddedBy = _admin.Fullname; _planRepository.CreateDetail(planDetail); return(RedirectToAction("detailtable")); } return(View(model)); }