Переглянути джерело

Fixed issue with POST saying event id not found.

Thomas Flucke 9 роки тому
батько
коміт
4ced5fc537
1 змінених файлів з 3 додано та 2 видалено
  1. 3 2
      server/app/controllers/EventsController.java

+ 3 - 2
server/app/controllers/EventsController.java

@@ -41,11 +41,12 @@ public class EventsController extends Controller {
     public Result update(long id)
     {
     	Event e = Json.fromJson(request().body().asJson(), Event.class);
-    	e.eventId = id;
-    	if (!JPA.em().contains(e))
+    	Event e0 = JPA.em().find(Event.class, id);
+    	if (e0 == null)
     	{
     		return notFound("No event with id "+id);
     	}
+    	e.eventId = id;
 		JPA.em().merge(e);
 		return ok(Json.toJson(e));
     }