public List<ReplacementViewModel> ReplacementIndex()
        {
            EmployeeRepository empRepo = new EmployeeRepository();
            var replacementList = entity.tblReplacements.ToList();
            var replacementListfromtabletwo = entity.tblListofDbforReplacements.ToList();
            List<ReplacementViewModel> ReplacementList = new List<ReplacementViewModel>();
            foreach(var replacementItem in replacementList)
            {
                 
                ReplacementViewModel replacementModel = new ReplacementViewModel()
                {
                   regularId = replacementItem.regularId,
                   replacementReason=replacementItem.Reason,
                   approver=replacementItem.tblApprover.approverName,
                   replaceId = replacementItem.replacingId,           
                   todate=replacementItem.ToDate,
                   fromdate=replacementItem.FromDate,
                   approverId=replacementItem.approverId

                };
                replacementModel.ReplacingEmployee = empRepo.ListOfEmployees().Where( x => x.employeeId == replacementItem.replacingId).FirstOrDefault().EmployeeName;
                replacementModel.RegularEmployee = empRepo.ListOfEmployees().Where(x => x.employeeId == replacementItem.regularId).FirstOrDefault().EmployeeName;
                
                ReplacementList.Add(replacementModel);
                }
            
            return ReplacementList;

        }
 //
 // GET: /Replacement/Create
 public ActionResult Create()
 {
     ReplacementViewModel replaceModel = new ReplacementViewModel();
     replaceModel.Regular_Employee = dropRepo.EmployeesDrop();
     replaceModel.Replacing_Employee = dropRepo.EmployeesDrop();
     replaceModel.ApproverList = dropRepo.ApproverDropDown();
     return View(replaceModel);
 }
 public ActionResult Create(ReplacementViewModel replacementModel)
 {
     try
     {
         // TODO: Add insert logic here
         replacementRepo.AddReplacementRecord(replacementModel);
         return RedirectToAction("ReplacementRecords","Replacement");
     }
     catch
     {
         return View();
     }
 }
        public void AddReplacementRecord(ReplacementViewModel modelObj)
        {

            tblReplacement newReplacement = new tblReplacement()
            {
                replacementId= modelObj.replacementId,
                regularId=modelObj.regularId,
                replacingId=modelObj.replaceId,
                Reason=modelObj.replacementReason,
                approverId=modelObj.approverId,
                FromDate=modelObj.fromdate,
                ToDate=modelObj.todate,
                

            };
            entity.tblReplacements.Add(newReplacement);
            entity.SaveChanges();

        }