public async Task <IActionResult> Create([Bind("Id,ModelId,NameInModel,NameInTable,PropertyType,PropertyInDatabaseType,NotMapped,Size,Distinct,Nullable,NavigationPropertyId,PK,FK")] Property mproperty) { if (ModelState.IsValid) { _context.Add(mproperty); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["ModelId"] = new SelectList(_context.Models, "Id", "Name"); ViewData["NavigationPropertyId"] = new SelectList(_context.NavigationProperties, "Id", "Name"); return(View(mproperty)); }
public async Task <IActionResult> Create([Bind("Id,ModelId,PrevId,Name,NavigationPropertyType")] NavigationProperty navigationProperty) { if (ModelState.IsValid) { _context.Add(navigationProperty); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["ModelId"] = new SelectList(_context.Models, "Id", "Id", navigationProperty.ModelId); ViewData["PrevId"] = new SelectList(_context.NavigationProperties, "Id", "Id", navigationProperty.PrevId); return(View(navigationProperty)); }
public async Task <IActionResult> AddOrEdit([Bind("Id_engine,Version,EDescription")] Engine engine) { if (ModelState.IsValid) { if (engine.Id_engine == 0) { _context.Add(engine); } else { _context.Update(engine); } await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(engine)); }