public ActionResult Create(LearningMVC.Models.UserList userDetails)
 {
     try
     {
         var user = new User();
         if (userDetails != null)
         {
             user.UserId      = userDetails.UserId;
             user.FirstName   = userDetails.FirstName;
             user.LastName    = userDetails.LastName;
             user.Address     = userDetails.Address;
             user.PhoneNo     = userDetails.PhoneNo;
             user.EMail       = userDetails.EMail;
             user.Company     = userDetails.Company;
             user.Designation = userDetails.Designation;
         }
         unitOfWork.UserRepository.Insert(user);
         unitOfWork.Save();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        /// <summary>
        /// Get Action for Delete
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Delete(int id)
        {
            var user        = new LearningMVC.Models.UserList();
            var userDetails = unitOfWork.UserRepository.GetByID(id);

            if (userDetails != null)
            {
                user.FirstName   = userDetails.FirstName;
                user.LastName    = userDetails.LastName;
                user.Address     = userDetails.Address;
                user.PhoneNo     = userDetails.PhoneNo;
                user.EMail       = userDetails.EMail;
                user.Company     = userDetails.Company;
                user.Designation = userDetails.Designation;
            }
            return(View(user));
        }
        public ActionResult Delete(int id, LearningMVC.Models.UserList userDetails)
        {
            try
            {
                var user = unitOfWork.UserRepository.GetByID(id);

                if (user != null)
                {
                    unitOfWork.UserRepository.Delete(id);
                    unitOfWork.Save();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }