public ActionResult Edit(int id) { EmployeeVM viewModel = new EmployeeVM(); EmployeeBAL balObject = new EmployeeBAL(); IQueryable <Entities.Employee> entites = balObject.FindBy(a => a.EmployeeId == id); if (entites != null && entites.Count() > 0) { Entities.Employee entity = entites.FirstOrDefault(); viewModel.EmployeeId = entity.EmployeeId; viewModel.EmployeeCode = entity.EmployeeCode.Trim(); viewModel.Password = entity.Password.Trim(); viewModel.FirstName = entity.FirstName.Trim(); viewModel.MiddleName = entity.MiddleName.Trim(); viewModel.LastName = entity.LastName.Trim(); viewModel.Category = entity.Category.Trim(); viewModel.Address = entity.Address.Trim(); viewModel.ContactNo = entity.ContactNo.Trim(); viewModel.DOB = entity.DOB; viewModel.JoiningDate = entity.JoiningDate; } return(View(viewModel)); }