public async Task <IActionResult> Create([Bind("TypeMotorcycleId,Name")] TypeMotorcycle typeMotorcycle) { if (ModelState.IsValid) { _context.Add(typeMotorcycle); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(typeMotorcycle)); }
public async Task <IActionResult> Create([Bind("BrandId,Name")] Brand brand) { if (ModelState.IsValid) { _context.Add(brand); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(brand)); }
public async Task <IActionResult> Create([Bind("DisplacementId,Name")] Displacement displacement) { if (ModelState.IsValid) { _context.Add(displacement); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(displacement)); }
public async Task <IActionResult> Create([Bind("MotorcycleId,Year,Price,Length,Width,Height,Weight,TypeMotorcycleId,BrandId,ModelMotorcycleId,DisplacementId")] Motorcycle motorcycle) { if (ModelState.IsValid) { _context.Add(motorcycle); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BrandId"] = new SelectList(_context.Brand, "BrandId", "Name", motorcycle.BrandId); ViewData["DisplacementId"] = new SelectList(_context.Displacement, "DisplacementId", "Name", motorcycle.DisplacementId); ViewData["ModelMotorcycleId"] = new SelectList(_context.ModelMotorcycle, "ModelMotorcycleId", "Name", motorcycle.ModelMotorcycleId); ViewData["TypeMotorcycleId"] = new SelectList(_context.TypeMotorcycle, "TypeMotorcycleId", "Name", motorcycle.TypeMotorcycleId); return(View(motorcycle)); }