public async Task <IActionResult> Edit(int id, LoveTeam student) { if (id == 0) { return(BadRequest()); } if (student == null) { return(BadRequest()); } try { student.LoveTeamId = id; context.LoveTeams.Update(student); await context.SaveChangesAsync(); return(Ok(new { result = "Successfully updated" })); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <IActionResult> Create(LoveTeam student) { if (student == null) { return(BadRequest()); } try { context.LoveTeams.Add(student); await context.SaveChangesAsync(); return(Ok(new { result = "Successfully saved" })); } catch (Exception e) { return(BadRequest(e.Message)); } }