public ActionResult DeleteLeaveAllocation(int id) { LeaveAllocation leaveAllocation = LeaveAllocationRepo.GetById(id); LeaveAllocationRepo.Delete(leaveAllocation); return(Json(new { success = true })); }
public List <LeaveAllocationViewModel> MappingLeaveAllocations() { List <LeaveAllocation> leaveAllocation = LeaveAllocationRepo.GetAll().ToList(); MapperConfiguration config = new MapperConfiguration(cfg => { cfg.CreateMap <LeaveAllocation, LeaveAllocationViewModel>(); }); Mapper = config.CreateMapper(); List <LeaveAllocationViewModel> leaveAllocationViewModels = Mapper.Map <List <LeaveAllocation>, List <LeaveAllocationViewModel> >(leaveAllocation); return(leaveAllocationViewModels); }