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 DeleteAction extends Action {
@Override
public Resolution execute(ActionContext context) throws Exception {
String id = context.param("id");
if (Utils.isNotBlank(id)) {
SqlBuilder sql = new SqlBuilder(
"delete from messages where id=?", id);
DbUtils.execute(sql);
}
return CrudLogic.read();
}
}