// GET: LeaveAllocations/Edit/5 public ActionResult Edit(int id) { if (!_leaveallocationrepo.isExists(id)) { return(NotFound()); } var leaveAllocation = _leaveallocationrepo.FindById(id); var model = _mapper.Map <EditLeaveAllocationViewModel>(leaveAllocation); return(View(model)); }