public async Task <IActionResult> Edit(long id, [Bind("OfoMinorId,OfoMinorCode,OfoMinorTitle,OfoSubMajorId,FinancialYearId")] OfoMinor ofoMinor) { if (id != ofoMinor.OfoMinorId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ofoMinor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OfoMinorExists(ofoMinor.OfoMinorId)) { return(NotFound()); } else { throw; } } ViewData["FinancialYearId"] = new SelectList(_context.Financialyear, "FinancialyearId", "FinancialyearDesc", ofoMinor.FinancialYearId); return(RedirectToAction(nameof(Index))); } return(PartialView(ofoMinor)); }
public async Task <IActionResult> Create([Bind("OfoMinorId,OfoMinorCode,OfoMinorTitle,OfoSubMajorId,FinancialYearId")] OfoMinor ofoMinor) { if (ModelState.IsValid) { _context.Add(ofoMinor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FinancialYearId"] = new SelectList(_context.Financialyear, "FinancialyearId", "FinancialyearDesc", ofoMinor.FinancialYearId); return(PartialView(ofoMinor)); }