public IActionResult Edit(int id)
        {
            var make = makesService.GetById(id);

            if (make == null)
            {
                return(this.BadRequest());
            }

            var viewModel = Mapper.Map <EditMakeModel>(make);

            return(this.View(viewModel));
        }
示例#2
0
        public IActionResult All(int id)
        {
            var make = makesService.GetById(id);

            if (make == null)
            {
                return(this.BadRequest());
            }

            var viewModel = make.Models
                            .AsQueryable()
                            .To <DisplayModelModel>()
                            .OrderBy(x => x.Name);

            this.ViewBag.MakeId   = make.Id;
            this.ViewBag.MakeName = make.Name;

            return(this.View(viewModel));
        }
示例#3
0
        public bool Exists(int makeId, string modelName)
        {
            var make = makesService.GetById(makeId);

            if (make == null)
            {
                return(false);
            }

            return(make.Models
                   .Any(x => x.Name == modelName));
        }