Example #1
0
        public ActionResult DeleteLeaveAllocation(int id)
        {
            LeaveAllocation leaveAllocation = LeaveAllocationRepo.GetById(id);

            LeaveAllocationRepo.Delete(leaveAllocation);

            return(Json(new
            {
                success = true
            }));
        }
Example #2
0
        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);
        }