public Object UpdatePublic(int id, ProfessorPublicDTO entity) { var professor = _context.Professors.SingleOrDefault(p => p.ID == id); if (professor == null) { return(new { success = false, message = "Could not find professor" }); } professor.Email = entity.Email; professor.Name = entity.Name; professor.RoomNumber = entity.RoomNumber; professor.Title = entity.Title; _context.Professors.Update(professor); _context.SaveChanges(); return(new { success = true, message = "Information updated" }); }
public IActionResult UpdatePublic(int id, [FromBody] ProfessorPublicDTO professor) { return(new ObjectResult(_respository.UpdatePublic(id, professor))); }