public async Task <IActionResult> PutUrlViewModel(int id, UrlViewModel urlViewModel) { if (id != urlViewModel.Id) { return(BadRequest()); } _context.Entry(urlViewModel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UrlViewModelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,User,Groups")] AdminModel adminModel) { if (ModelState.IsValid) { _context.Add(adminModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(adminModel)); }
public async Task <IActionResult> Create([Bind("Id,Title,Created,Modified,Active,UrlHash,User,Address,ShortAddress")] UrlViewModel urlViewModel) { if (ModelState.IsValid) { urlViewModel.Modified = DateTime.UtcNow; _context.Add(urlViewModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(urlViewModel)); }
public async Task <IActionResult> Create([Bind("Id,Source,Url")] WhiteListModel whiteListModel) { if (ModelState.IsValid) { whiteListModel.Modified = DateTime.UtcNow; _context.Add(whiteListModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(whiteListModel)); }