public async Task <IActionResult> Create([Bind("MaterialId,Code,Name")] Material source) { if (ModelState.IsValid) { context.Add(source); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(source)); }
public async Task <IActionResult> Create([Bind("UnitId,Description")] Unit source) { if (ModelState.IsValid) { context.Add(source); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(source)); }
public async Task <IActionResult> Create([Bind("RecordId,ComponentId,Income,Expense")] IncomeExpenseBook source) { if (ModelState.IsValid) { context.Add(source); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } //ViewData["ComponentId"] = new SelectList(context.Components.Include(c => c.Detail).Include(c => c.Material), "ComponentId", "Material.Name", source.RecordId); ViewData["ComponentId"] = new SelectList(context.Components, "ComponentId", "ComponentId", source.RecordId); return(View(source)); }
public async Task <IActionResult> Create([Bind("ComponentId,DetailId,MaterialId,UnitId")] Component source) { if (ModelState.IsValid) { context.Add(source); await context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DetailId"] = new SelectList(context.Details, "DetailId", "Code", source.DetailId); ViewData["MaterialId"] = new SelectList(context.Materials, "MaterialId", "Name", source.MaterialId); ViewData["UnitId"] = new SelectList(context.Units, "UnitId", "Description", source.UnitId); return(View(source)); }