public async Task <IActionResult> Edit(Guid id, [Bind("Id,Name,DateCreated")] Category category) { if (id != category.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }
public IActionResult Update(int id, [FromBody] Category catObject) { if (catObject == null) { return(BadRequest()); } _context.Update(catObject); return(CreatedAtRoute("GetAll", null)); }
public async Task <ActionResult> EditCategory(Category category) { // TypeArticle.GamblingAddiction.GetDisplayName(); if (ModelState.IsValid) { await _categoryContext.Update(category); return(RedirectToAction("CategoryList")); } return(View("Category/EditCategory", category)); }
public void Update(Category category) { categoryContext.Update(category); categoryContext.SaveChanges(); }