public ActionResult Delete(int id, EmployeeJobInfoVM model)
        {
            try
            {
                // TODO: Adding delete logic here
                var empJobInfo = _repo.FindById(id);

                if (empJobInfo == null)
                {
                    return(NotFound());
                }

                var isSuccess = _repo.Delete(empJobInfo);

                if (!isSuccess)
                {
                    return(View(model));
                }
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View(model));
            }
        }
        public ActionResult Create(EmployeeJobInfoVM model)
        {
            try
            {
                // TODO: Adding insert logic here
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                var empJobInfo = _mapper.Map <EmployeeJobInfo>(model);

                var isSuccess = _repo.Create(empJobInfo);
                if (!isSuccess)
                {
                    ModelState.AddModelError("", "There is a fault somewhere...");
                    return(View(model));
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                ModelState.AddModelError("", "There is a fault somewhere...");
                return(View(model));
            }
        }
 public ActionResult Edit(EmployeeJobInfoVM model)
 {
     try
     {
         // TODO: Adding update logic here
         if (!ModelState.IsValid)                // Validating the data
         {
             return(View(model));
         }
         var empJobInfo = _mapper.Map <EmployeeJobInfo>(model);           // Mapping from ViewModel to Data class and storing in variable
         var isSuccess  = _repo.Update(empJobInfo);
         if (!isSuccess)
         {
             ModelState.AddModelError("", "There is a fault somewhere...");
             return(View(model));
         }
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         ModelState.AddModelError("", "There is a fault somewhere...");
         return(View(model));
     }
 }