public async Task <IActionResult> Edit(long id, [Bind("OfoId,OfoCode,OfoTitle,OfoUnitId,FinancialYearId")] Ofo ofo) { if (id != ofo.OfoId) { return(NotFound()); } if (ModelState.IsValid) { /* ofo.LastUpdatedBy = "admin"; * ofo.DateUpdated = DateTime.Now;*/ try { _context.Update(ofo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OfoExists(ofo.OfoCode)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FinancialYearId"] = new SelectList(_context.Financialyear, "FinancialyearId", "FinancialyearDesc", ofo.FinancialYearId); ViewData["OfoUnitId"] = new SelectList(_context.OfoUnit, "OfoUnitId", "OfoUnitITitle", ofo.OfoUnitId); return(PartialView(ofo)); }
public async Task <IActionResult> Create([Bind("OfoId,OfoCode,OfoTitle,OfoUnitId,FinancialYearId")] Ofo ofo) { if (ModelState.IsValid) { _context.Add(ofo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["FinancialYearId"] = new SelectList(_context.Financialyear, "FinancialyearId", "FinancialyearDesc", ofo.FinancialYearId); ViewData["OfoUnitId"] = new SelectList(_context.OfoUnit, "OfoUnitId", "OfoUnitTitle", ofo.OfoUnitId); return(PartialView(ofo)); }