示例#1
0
        public async Task <ActionResult> MyLeave()
        {
            var employee = await _userManager.GetUserAsync(User);


            var leaveRequests = (await _leaveRequestRepo.FindAll())
                                .Where(q => q.RequestingEmployeeId == employee.Id);
            var leaveAllocations = (await _leaveAllocationRepo.FindAll())
                                   .Where(q => q.EmployeeId == employee.Id);

            var leaveAllocationsIds = (await _leaveAllocationRepo.FindAll())
                                      .Where(q => q.EmployeeId == employee.Id.ToString())
                                      .Select(q => q.LeaveTypeId);
            var leaveTypeInfo = (await _leaveTypeRepo.FindAll())
                                .Where(q => leaveAllocationsIds.Contains(q.Id));



            var leaveRequestsVM    = _mapper.Map <List <LeaveRequestVM> >(leaveRequests);
            var leaveAllocationsVM = _mapper.Map <List <LeaveAllocationVM> >(leaveAllocations);
            var leaveTypeInfoVM    = _mapper.Map <List <LeaveTypeVM> >(leaveTypeInfo);



            var model = new EmployeeLeaveRequestViewVM
            {
                LeaveRequests    = leaveRequestsVM,
                LeaveAllocations = leaveAllocationsVM,
                LeaveTypesInfo   = leaveTypeInfoVM
            };

            return(View(model));
        }
        // GET: LeaveRequest/Create
        public ActionResult Create()
        {
            var leaveTypes = _leaveTypeRepo.FindAll().Select(q => new SelectListItem {
                Value = q.Id.ToString(), Text = q.Name
            });
            var model = new CreateLeaveRequestVM
            {
                LeaveTypes = leaveTypes
            };

            return(View(model));
        }
示例#3
0
        // GET: LeaveRequest/Create
        public async Task <ActionResult> Create()
        {
            var leaveTypes = await _leaveTypeRepo.FindAll();

            var leaveTypeItems = leaveTypes.Select(lt => new SelectListItem(lt.Name, lt.Id.ToString()));
            var model          = new CreateLeaveRequestVM
            {
                LeaveTypes = leaveTypeItems
            };

            return(View(model));
        }
示例#4
0
        // GET: LeaveRequestController/Create
        public async Task <ActionResult> Create()
        {
            var leaveTypes = await _typeRepo.FindAll();

            var leaveTypeItems = leaveTypes.Select(q => new SelectListItem {
                Text = q.Name, Value = q.Id.ToString()
            });
            var model = new CreateLeaveRequestViewModel
            {
                LeaveTypes = leaveTypeItems
            };

            return(View(model));
        }
示例#5
0
        // GET: LeaveRequest/Create
        public ActionResult Create()
        {
            var leaveTypes      = _leaveTypeRepo.FindAll();
            var leaveTypesItems = leaveTypes.Select(q => new SelectListItem
            { //Se crea un objeto select desde el controlador para mostrarlo en el view
                Text  = q.Name,
                Value = q.Id.ToString()
            });
            var model = new CreateLeaveRequestVM
            {
                LeaveTypes = leaveTypesItems
            };

            return(View(model));
        }
        // GET: LeaveRequest/Create
        public ActionResult Create()
        {
            var leavetypes         = _leavTyperepo.FindAll();
            var leavetypeviewietms = leavetypes.Select(q => new SelectListItem
            {
                Text  = q.Name,
                Value = q.Id.ToString()
            });
            var model = new CreateLeaveRequestVM
            {
                LeaveTypes = leavetypeviewietms
            };

            return(View(model));
        }
        public ActionResult Create()
        {
            var leaveTypes     = _leaveTypeRepository.FindAll();
            var leaveTypeItems = leaveTypes.Select(q => new SelectListItem
            {
                Text  = q.Name,
                Value = q.Id.ToString()
            });
            var model = new CreateLeaveRequestViewModel
            {
                LeaveTypes = leaveTypeItems
            };

            return(View(model));
        }
示例#8
0
        // GET: LeaveTypes
        public ActionResult Index()
        {
            var leavetypes = _repo.FindAll().ToList();
            var model      = _mapper.Map <List <LeaveType>, List <LeaveTypeVM> >(leavetypes); //Mapping from Leavetype to LeaveTypeVM

            return(View(model));
        }
        // GET: LeaveRequestController/Create
        public async Task <ActionResult> Create()
        {
            var leaveTypes = await _leaveTypeRepo.FindAll();

            var leaveTypeItems = leaveTypes.Select(q => new SelectListItem // To convert it to IEnumerable<SelectListItem> .
            {
                Text  = q.Name,
                Value = q.Id.ToString()
            });
            var model = new CreateLeaveRequestVM
            {
                LeaveTypes = leaveTypeItems
            };

            return(View(model));
        }
示例#10
0
        //[Authorize] //Agrega autenticación para la acción a la que se le puso
        // GET: LeaveTypes
        public ActionResult Index()
        {
            var leavetypes = _repo.FindAll().ToList();                                        //Se obtiene los datos de la base de datos por medio de las operaciones del repositorio
            var model      = _mapper.Map <List <LeaveType>, List <LeaveTypeVM> >(leavetypes); //Mapea los datos que vienen en formato Data a ViewModel para que los pueda leer el View()

            return(View(model));
        }
        public IActionResult Index()
        {
            var leaveTypes = _repository.FindAll().ToList();
            var model      = _mapper.Map <List <LeaveType>, List <LeaveTypeViewModel> >(leaveTypes);

            return(View(model));
        }
        // GET: LeaveTypes
        public ActionResult Index()
        {
            var leavetypes = _repo.FindAll().ToList();                                               // Get the data from leave type repo
            var model      = _mapper.Map <List <LeaveType>, List <LeaveTypeViewModel> >(leavetypes); // map data

            return(View(model));
        }
        // GET: LeaveTypeController1
        public ActionResult Index()
        {
            var LeaveTypes = _repo.FindAll().ToList();
            var Model      = _mapper.Map <List <LeaveType>, List <LeaveTypeViewModel> >(LeaveTypes);

            return(View(Model));
        }
示例#14
0
        // GET: LeaveTypesController
        public ActionResult Index()
        {
            var leaveTypes = _repo.FindAll();
            var viewModel  = _mapper.Map <ICollection <LeaveType>, List <LeaveTypeVM> >(leaveTypes);

            return(View(viewModel));
        }
        /// <summary>
        /// GET: LeaveTypesController
        /// Abre pagina Index para Tipos de Licencia
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> Index()
        {
            var leavetypes = (await _repo.FindAll()).ToList();
            var model      = _mapper.Map <List <LeaveType>, List <LeaveTypeViewModel> >(leavetypes);

            return(View(model));
        }
        // GET: LeaveRequest/Create
        public async Task <ActionResult> Create()
        {
            var leaveTypes = await _repoleavetype.FindAll();

            var leavetypeitems = leaveTypes.Select(x => new SelectListItem
            {
                Value = x.Id.ToString(),
                Text  = x.Name
            });
            var model = new CreateLeaveRequestVM
            {
                LeaveTypes = leavetypeitems,
            };

            return(View(model));
        }
示例#17
0
        // GET: LeaveTypesController

        public ActionResult Index()
        {
            var leaveTypes = _repo.FindAll().ToList();                                               //This happens in the data layer.  Now you need to convert the results into the ViewModel
            var model      = _mapper.Map <List <LeaveType>, List <DetailsLeaveTypeVM> >(leaveTypes); //Maps from the Data table class to the ViewModel

            return(View(model));
        }
示例#18
0
        // GET: LeaveTypeController
        public ActionResult Index()
        {
            var leaveType = _repo.FindAll().ToList();
            var model     = _mapper.Map <List <LeaveType>, List <LeaveTypeVM> >(leaveType);

            return(View(model));
        }
        // GET: LeaveRequest/Create
        public ActionResult Create()
        {
            //Retrieving leavetype list from the database
            var leaveTypes     = _leaveTypeRepo.FindAll();
            var leaveTypeItems = leaveTypes.Select(q => new SelectListItem
            {
                Text  = q.Name,
                Value = q.Id.ToString()
            });
            //pass the data into the form
            var model = new CreateLeaveRequestVM
            {
                LeaveTypes = leaveTypeItems
            };

            return(View(model));
        }
示例#20
0
        // GET: LeaveTypes
        public async Task <ActionResult> Index()
        {
            var leaveTypes = await _repo.FindAll();

            var model = _mapper.Map <ICollection <LeaveType>, List <LeaveTypeVM> >(leaveTypes);

            return(View(model));
        }
示例#21
0
        // GET: LeaveRequestController/Create
        public async Task <ActionResult> Create()
        {
            var leaveTypes = await _leaveRepo.FindAll();

            var leaveTypeItems = leaveTypes
                                 .Select(q => new SelectListItem {
                Text  = q.Name,
                Value = q.Id.ToString()
            });
            var model = new CreateLeaveRequestVM()
            {
                LeaveTypes      = leaveTypeItems,
                RequestComments = "Escriba aquí"
            };

            return(View(model));
        }
示例#22
0
        // GET: LeaveType
        public ActionResult Index()
        {
            // _repo.FindAll is returning List of LeaveType object, we need a mapper to map it to the corresponding View Model
            var leavetypes = _repo.FindAll().ToList();
            var model      = _mapper.Map <List <LeaveType>, List <LeaveTypeVM> >(leavetypes);

            return(View(model));
        }
        // GET: LeaveTypes

        public ActionResult Index()
        {
            var leaveTypes = _repo.FindAll().ToList();
            // put value to LeaveTypeVM's all variable
            var model = _mapper.Map <List <LeaveType>, List <LeaveTypeVM> >(leaveTypes);

            return(View(model));
        }
示例#24
0
        // GET: LeaveTypesController
        public ActionResult Index()
        {
            var leaveTypes = _repo.FindAll().ToList(); // remember that this returns data objects (model class)
            // Our view needs to have the ViewModel objects - so we need to map the data class object to the ViewModel class object
            var model = _mapper.Map <List <LeaveType>, List <DetailsLeaveTypeViewModel> >(leaveTypes);

            return(View(model)); // passing in ViewModel obj
        }
        // GET: LeaveTypes
        public async Task <ActionResult> Index()
        {
            var LT = await _repo.FindAll();

            var m = _Mapper.Map <List <LeaveType>, List <LeaveTypeVM> >(LT.ToList());

            return(View(m));
        }
        // GET: LeaveType
        public ActionResult Index()
        {
            var leaveTypes = _repo.FindAll().ToList();
            //creating model using mapper (Data Model to View Model). Actually it copies only required fields for our view model
            var model = _mapper.Map <List <LeaveType>, List <LeaveTypeVM> >(leaveTypes);

            return(View(model));
        }
        // GET: LeaveRequest/Create
        public async Task <ActionResult> Create()
        {
            var leaveTypes = await _leaveTypeRepo.FindAll();

            //convert the leaveTypes list into an IEnumerable SelectListItem to match our CreateLeaveRequestVM
            var leaveTypeItems = leaveTypes.Select(t => new SelectListItem {
                Text  = t.Name,         //what we see rendered
                Value = t.id.ToString() //the actual value (value is string)
            });

            var model = new CreateLeaveRequestVM
            {
                LeaveTypes = leaveTypeItems
            };

            return(View(model));
        }
示例#28
0
        // GET: LeaveTypes
        public ActionResult Index()
        {
            var leavetype = _repo.FindAll().ToList();                                   //data to this view
            // but this data is not in the view type format have to convert it.
            var model = _mapper.Map <List <LeaveType>, List <LeaveTypeVM> >(leavetype); //this will hold the mapped vertion of data.

            return(View(model));
        }
        // GET: LeaveRequest/Create
        public async Task <ActionResult> Create()
        {
            //require selectlistitem of leavetype so we need link here
            var leaveTypes = await _leaveTypeRepo.FindAll();

            //i want this list and represent the data for ech item
            var leaveTypeItems = leaveTypes.Select(q => new SelectListItem
            {
                Text  = q.Name,
                Value = q.Id.ToString()
            });
            var model = new CreateLeaveRequestVM
            {
                LeaveTypes = leaveTypeItems
            };

            return(View(model));
        }
        // GET: LeaveRequestController/Create
        public async Task <ActionResult> Create()
        {
            ICollection <LeaveType> leaveTypes = await _leaveTypeRepo.FindAll();

            IEnumerable <SelectListItem> leaveTypeItems = leaveTypes
                                                          .Select(q => new SelectListItem
            {
                Text  = q.Name,
                Value = q.Id.ToString()
            });

            CreateLeaveRequestViewModel model = new CreateLeaveRequestViewModel
            {
                LeaveTypes = leaveTypeItems
            };

            return(View(model));
        }