예제 #1
0
 // GET /product/
 public IEnumerable <TypeModel> GetAll()
 {
     return(_repository.GetAll().Select(product => new TypeModel
     {
         Id = product.Id,
         Name = product.Name,
         //ProductEntity = _repository1.GetAll().Where(== )
     }));
 }
예제 #2
0
        public PartialViewResult Menu(string category = null)
        {
            ViewBag.SelectedCategory = category;

            IEnumerable <string> categories = _repository.GetAll().ToArray()
                                              .Select(type => type.Name)
                                              .Distinct()
                                              .OrderBy(x => x);

            return(PartialView(categories));
        }
예제 #3
0
        private JobsOutput Navigator(JobsOutput input)
        {
            var output = input;

            if (output.JobsListModel != null && output.JobsListModel.Count > 0)
            {
                //templates
                var templateIdList = output.JobsListModel.Select(x => x.TemplateId);
                var templates      = _templatesRepository.GetAll();

                var filteredTemplates = new List <Templates>();
                if (templateIdList.Count() > 0 && templates.Count > 0)
                {
                    filteredTemplates = templates.Where(x => templateIdList.Contains(x.Id)).ToList();
                }
                //templates

                //queries
                var queryIdList = output.JobsListModel.Select(x => x.QueryId);
                var queries     = _queriesRepository.GetAll();

                var filteredQueries = new List <Queries>();
                if (queryIdList.Count() > 0 && queries.Count > 0)
                {
                    filteredQueries = queries.Where(x => queryIdList.Contains(x.Id)).ToList();
                }
                //queries

                //types
                var typeIdList = output.JobsListModel.Select(x => x.TypeId);
                var types      = _typesRepository.GetAll();

                var filteredTypes = new List <Types>();
                if (typeIdList.Count() > 0 && types.Count > 0)
                {
                    filteredTypes = types.Where(x => typeIdList.Contains(x.Id)).ToList();
                }
                //types

                foreach (var job in output.JobsListModel)
                {
                    var selectedTemplate = filteredTemplates.Where(x => x.Id == job.TemplateId).SingleOrDefault();
                    job.TemplatesModel = selectedTemplate != null?_mapper.Map <TemplatesDto>(selectedTemplate) : null;

                    var selectedQuery = filteredQueries.Where(x => x.Id == job.QueryId).SingleOrDefault();
                    job.QueriesModel = selectedQuery != null?_mapper.Map <QueriesDto>(selectedQuery) : null;

                    var selectedType = filteredTypes.Where(x => x.Id == job.TypeId).SingleOrDefault();
                    job.TypesModel = selectedType != null?_mapper.Map <TypesDto>(selectedType) : null;
                }
            }
            else
            {
                //template
                var templateInput = new TemplatesInput();
                output.JobsModel = new JobsDto();
                var templateId = output.JobsModel.TemplateId;
                templateInput.Id = templateId.Value;
                var template = _templatesRepository.GetTemplateById(templateInput);
                output.JobsModel.TemplatesModel = _mapper.Map <TemplatesDto>(template.TemplatesModel);
                //template

                //query
                var queryInput = new QueriesInput();
                var queryId    = output.JobsModel.QueryId;
                queryInput.Id = queryId.Value;
                var query = _queriesRepository.GetQueryById(queryInput);
                output.JobsModel.QueriesModel = _mapper.Map <QueriesDto>(query.QueriesModel);
                //query

                //type
                var typeInput = new TypesInput();
                var typeId    = output.JobsModel.QueryId;
                typeInput.Id = typeId.Value;
                var type = _typesRepository.GetTypeById(typeInput);
                output.JobsModel.TypesModel = _mapper.Map <TypesDto>(type.TypesModel);
                //type
            }

            return(output);
        }
예제 #4
0
파일: ORM.cs 프로젝트: yurakozlovskiy/Post
 public IEnumerable <Types> GetAllTypes()
 {
     return(typesRepository.GetAll());
 }
예제 #5
0
 // GET: Furnitures/Search
 public IActionResult Search()
 {
     ViewData["TypeId"]    = new SelectList(_typeRepository.GetAll(), "TypeId", "TypeName");
     ViewData["SubtypeId"] = new SelectList(_subtypeRepository.GetAll(), "SubtypeId", "SubtypeName");
     return(View());
 }
 // GET: Subtypes/Create
 public IActionResult Create()
 {
     ViewData["TypeId"] = new SelectList(_typeRepository.GetAll(), "TypeId", "TypeName");
     return(View());
 }
 // GET: Types
 public IActionResult Index()
 {
     return(View(_repository.GetAll()));
 }
예제 #8
0
 public IList <TypeSet> GetTypes()
 {
     return(_typesRepository.GetAll());
 }