package app.action.crud;
import app.logic.CrudLogic;
import com.blogger.tcuri.appserver.Action;
import com.blogger.tcuri.appserver.ActionContext;
import com.blogger.tcuri.appserver.Utils;
import com.blogger.tcuri.appserver.db.DbUtils;
import com.blogger.tcuri.appserver.db.SqlBuilder;
import com.blogger.tcuri.appserver.db.Transactional;
import com.blogger.tcuri.appserver.resolution.Resolution;
@Transactional
public class UpdateAction extends Action {
@Override
public Resolution execute(ActionContext context) throws Exception {
String id = context.param("id");
String content = context.param("content");
if (Utils.isNotBlank(id) && Utils.isNotBlank(content)) {
SqlBuilder sql = new SqlBuilder(
"update messages set content=? where id=?", content, id);
DbUtils.execute(sql);
}
return CrudLogic.read();
}
}