public async Task <IActionResult> Edit(int id, [Bind("Id,Nasname,Shortname,Type,Ports,Secret,Server,Community,Description")] Nas nas) { if (id != nas.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(nas); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NasExists(nas.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(nas)); }
public async Task <IActionResult> Create([Bind("Id,Nasname,Shortname,Type,Ports,Secret,Server,Community,Description")] Nas nas) { if (ModelState.IsValid) { _context.Add(nas); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(nas)); }
public ServiceResponse <Nas> InsertNas(Nas model) { try { _nasRepository.Insert(model); return(new ServiceResponse <Nas>(model, true, 100, "İşlem başarılı")); } catch (System.Exception ex) { return(new ServiceResponse <Nas>(ex)); } }
public async Task <ServiceResponse <Nas> > InsertNasAsync(Nas model) { return(await Task.Run(() => InsertNas(model))); }