public async Task <IActionResult> Post([FromBody] Attribute attribute) { context.Attributes.Add(attribute); var changes = await context.SaveChangesAsync(); if (changes > 0) { return(Ok()); } else { return(NotFound()); } }
public async Task <IActionResult> Put(int id, [FromBody] Attribute attribute) { attribute.ID = id; context.Update(attribute); var changes = await context.SaveChangesAsync(); if (changes > 0) { return(Ok()); } else { return(NotFound()); } }
public async Task <IActionResult> Delete(int id) { var attr = new Attribute { ID = id, }; context.Attributes.Remove(attr); var changes = await context.SaveChangesAsync(); if (changes > 0) { return(Ok()); } else { return(NotFound()); } }