public async Task <AttributeCategoryView> UpdateAttributeCategory(int attrCategoryId, string attrCategoryName) { AttributeCategory attributeCategory = new AttributeCategory { AttributeCategoryId = attrCategoryId, Name = attrCategoryName }; _context.Attach(attributeCategory); await _context.SaveChangesAsync(); return(_mapper.Map <AttributeCategory, AttributeCategoryView>(attributeCategory)); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Item).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemExists(Item.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }