public IActionResult DeleteStudent(string id) { var db = new s18964Context(); var d = new Student { IndexNumber = id }; db.Attach(d); db.Remove(d); db.SaveChanges(); return(Ok("Usuwanie ukonczone")); }
public IActionResult UpdateStudent(string id) { var db = new s18964Context(); var d1 = new Student { IndexNumber = id, LastName = "ZmienioneNazwisko" }; db.Attach(d1); db.Entry(d1).Property("LastName").IsModified = true; db.SaveChanges(); var res = db.Student.Where(student => student.IndexNumber == id).Select(student => new { Numer = student.IndexNumber, Nazwisko = student.LastName }); return(Ok(res)); }