public async Task <IActionResult> RegistrationLevel(RegistrationLevelViewModel model) { string userName = User.Identity.Name; RegistrationLevel level = new RegistrationLevel { Id = (int)model.levelId, levelName = model.levelName, levelNameBn = model.levelNameBn, shortOrder = model.shortOrder }; int id = await lostAndFoundType.SaveRegistrationLevel(level); return(RedirectToAction(nameof(RegistrationLevel))); }
public async Task <int> SaveRegistrationLevel(RegistrationLevel registrationLevel) { if (registrationLevel.Id != 0) { _context.RegistrationLevels.Update(registrationLevel); await _context.SaveChangesAsync(); return(1); } else { await _context.RegistrationLevels.AddAsync(registrationLevel); await _context.SaveChangesAsync(); return(1); } }