// GET: ModelMasterController/Create public async Task <ActionResult> Create() { var model = new VarientMasterModel(); var colourList = await _colourMasterService.GetAllColoursListAsync(); foreach (var item in colourList) { model.AvaillabelColoursList.Add(new SelectListItem { Value = item.Id.ToString(), Text = item.ColourName }); } return(View(model)); }
// GET: ModelMasterController public async Task <ActionResult> List() { var coloursList = await _colourMasterService.GetAllColoursListAsync(); if (coloursList == null) { return(View(new ColourMasterModel())); } var model = coloursList.Select(d => new ColourMasterModel { Id = d.Id, ColourCode = d.ColourCode, ColourName = d.ColourName, ColourType = d.ColourType, FriendlyName = d.FriendlyName, Active = d.Active, DateUpdated = d.DateUpdated, DateCreated = d.DateCreated }).ToList(); return(View(model)); }