public async Task <IActionResult> RemoveSubscription([FromBody] Coursemembership sub) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } context.Coursemembership.Remove(sub); await context.SaveChangesAsync(); return(NoContent()); }
public async Task <IActionResult> AddSubscription([FromBody] Coursemembership sub) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } context.Coursemembership.Add(sub); await context.SaveChangesAsync(); return(Created("Successfully subscribed", sub)); }