public ActionResult Edit(int?Id)
        {
            var DotBCBHXH = DotBCBHXHRepository.GetDotBCBHXHById(Id.Value);
            var detail    = DotBCBHXHDetailRepository.GetAllvwDotBCBHXHDetailByDotBCBHXHId(Id.Value).ToList();

            if (DotBCBHXH != null && DotBCBHXH.IsDeleted != true)
            {
                var model = new DotBCBHXHViewModel();
                AutoMapper.Mapper.Map(DotBCBHXH, model);
                model.ListDotBCBHXHDetail = new List <DotBCBHXHDetailViewModel>();
                foreach (var item in detail)
                {
                    var detailModel = new DotBCBHXHDetailViewModel();
                    AutoMapper.Mapper.Map(item, detailModel);
                    model.ListDotBCBHXHDetail.Add(detailModel);
                }

                if (model.CreatedUserId != Helpers.Common.CurrentUser.Id && Helpers.Common.CurrentUser.UserTypeId != 1)
                {
                    TempData["FailedMessage"] = "NotOwner";
                    return(RedirectToAction("Index"));
                }

                return(View(model));
            }
            if (Request.UrlReferrer != null)
            {
                return(Redirect(Request.UrlReferrer.AbsoluteUri));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult ListOfParticipatingAndProposedInsurance(int?DotBCBHXHId)
        {
            var model = dotBCBHXHDetailRepository.GetAllViewDotBCBHXHDetail().ToList();

            var DotBHXH = new DotBCBHXH();

            //Lấy danh sách nhân viên theo đợt

            //- Danh sách đã tham gia bảo hiểm

            //- chưa tham gia bảo hiểm
            if (DotBCBHXHId != null && DotBCBHXHId != -1)
            {
                model   = model.Where(n => n.DotBCBHXHId == DotBCBHXHId).ToList();
                DotBHXH = dotBCBHXHRepository.GetDotBCBHXHById(DotBCBHXHId.Value);
            }
            ViewBag.DotBHXH = DotBHXH;

            return(View(model));
        }