Example #1
0
        //obtiene la lista de solicitudes
        public ResponseViewModel GetList(RequestViewModel model)
        {
            //variables
            DateTime        dateIni = Convert.ToDateTime(model.DateStart);
            DateTime        dateEnd = Convert.ToDateTime(model.DateEnd);
            var             _result = new ResponseViewModel();
            List <requests> list    = new List <requests>();

            //obtengo la lista de solicitudes activas
            list = Repository.GetList(dateIni, dateEnd, model.TypeRequest).ToList();

            //valida si la lista tiene datos
            if (list.Count > 0)
            {
                _result.Data    = Map.EntityToViewModel(list).OfType <object>().ToList();
                _result.Success = true;
                _result.Message = "Lista de solicitudes cargado";
            }
            else
            {
                _result.Success = false;
                _result.Message = "No hay datos disponibles";
            }

            return(_result);
        }