public void AddApprover(ApproverViewModel modelObj)
 {
     tblApprover newApprover = new tblApprover()
     {
         approverID=modelObj.approverId,
         approverName=modelObj.approverName
     };
     entity.tblApprovers.Add(newApprover);
     entity.SaveChanges();
 }
        public ApproverViewModel approverDetails(int id)
        {
            var singleApprover = entity.tblApprovers.Where(x => x.approverID == id).FirstOrDefault();
            ApproverViewModel modelObj = new ApproverViewModel()
            {
                approverId = singleApprover.approverID,
                approverName = singleApprover.approverName

            };
            return modelObj;
        }
 public ActionResult Create(FormCollection collection, ApproverViewModel newModel)
 {
     try
     {
         // TODO: Add insert logic here
         approverRepo.AddApprover(newModel);
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
 public List<ApproverViewModel> ApproverList()
 {
     var approverList = entity.tblApprovers.ToList();
     List<ApproverViewModel> listofApprovers = new List<ApproverViewModel>();
     foreach(var approverItem in approverList)
     {
         ApproverViewModel modelObj = new ApproverViewModel()
         {
             approverId = approverItem.approverID,
             approverName = approverItem.approverName
         };
         listofApprovers.Add(modelObj);
     }
     return listofApprovers;
 }